@@ -239,14 +239,8 @@ public void testPolling() {
239
239
verify (httpClientSpy , times (2 )).get (anyString ());
240
240
}
241
241
242
- @ Test
243
- public void testGracefulInitializationFailure () {
244
- // Set up bad HTTP response
245
- mockHttpError ();
246
-
247
- // Initialize and no exception should be thrown.
248
- assertDoesNotThrow (() -> initFailingGracefulClient (true ));
249
- }
242
+ // NOTE: Graceful mode during init is intrinsically true since the call is non-blocking and
243
+ // exceptions are caught without rethrowing in `FetchConfigurationsTask`
250
244
251
245
@ Test
252
246
public void testClientMakesDefaultAssignmentsAfterFailingToInitialize () {
@@ -256,40 +250,13 @@ public void testClientMakesDefaultAssignmentsAfterFailingToInitialize() {
256
250
// Initialize and no exception should be thrown.
257
251
try {
258
252
EppoClient eppoClient = initFailingGracefulClient (true );
253
+ Thread .sleep (25 ); // Sleep to allow the async config fetch call to happen (and fail)
259
254
assertEquals ("default" , eppoClient .getStringAssignment ("experiment1" , "subject1" , "default" ));
260
255
} catch (Exception e ) {
261
256
fail ("Unexpected exception: " + e );
262
257
}
263
258
}
264
259
265
- @ Test
266
- public void testClientMakesDefaultAssignmentsAfterFailingToInitializeNonGracefulMode () {
267
- // Set up bad HTTP response
268
- mockHttpError ();
269
-
270
- // Initialize and the exception should be thrown.
271
- try {
272
- initFailingGracefulClient (false );
273
- fail ("Exception should have been thrown" );
274
- } catch (RuntimeException e ) {
275
- // Expected
276
- assertEquals ("Intentional Error" , e .getMessage ());
277
- } finally {
278
- assertEquals (
279
- "default" ,
280
- EppoClient .getInstance ().getStringAssignment ("experiment1" , "subject1" , "default" ));
281
- }
282
- }
283
-
284
- @ Test
285
- public void testNonGracefulInitializationFailure () {
286
- // Set up bad HTTP response
287
- mockHttpError ();
288
-
289
- // Initialize and assert exception thrown
290
- assertThrows (Exception .class , () -> initFailingGracefulClient (false ));
291
- }
292
-
293
260
public static void mockHttpError () {
294
261
// Create a mock instance of EppoHttpClient
295
262
EppoHttpClient mockHttpClient = mock (EppoHttpClient .class );
0 commit comments