Skip to content

Commit a6fa2ec

Browse files
committed
Fix broken test caused by change in OkHhttp MockWebServer default behaviour
1 parent e585ac2 commit a6fa2ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

providers/flagsmith/src/test/java/dev.openfeature.contrib.providers.flagsmith/FlagsmithProviderTest.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ public MockResponse dispatch(RecordedRequest request) {
6767
}
6868
};
6969

70+
final QueueDispatcher errorDispatcher = new QueueDispatcher() {
71+
@SneakyThrows
72+
@Override
73+
public MockResponse dispatch(RecordedRequest request) {
74+
return new MockResponse().setResponseCode(500);
75+
}
76+
};
77+
7078
private static Stream<Arguments> provideKeysForFlagResolution() {
7179
return Stream.of(
7280
Arguments.of("true_key", "getBooleanEvaluation", Boolean.class, "true"),
@@ -132,9 +140,9 @@ void setUp() throws IOException {
132140
// Error server will always result in FlagsmithApiError's used for
133141
// tests that need to handle this type of error
134142
mockFlagsmithErrorServer = new MockWebServer();
143+
mockFlagsmithErrorServer.setDispatcher(this.errorDispatcher);
135144
mockFlagsmithErrorServer.start();
136145

137-
138146
FlagsmithProviderOptions options = FlagsmithProviderOptions.builder()
139147
.apiKey("API_KEY")
140148
.baseUri(String

0 commit comments

Comments
 (0)