Skip to content

Commit

Permalink
fixup: test race condition fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
  • Loading branch information
toddbaert committed Jul 12, 2023
1 parent f0d716e commit 7eebd01
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/test/java/dev/openfeature/sdk/ProviderRepositoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void shouldImmediatelyReturnWhenCallingTheProviderMutator() throws Exception {
return true;
});

verify(featureProvider).initialize(any());
verify(featureProvider, timeout(TIMEOUT)).initialize(any());
}

@Test
Expand Down Expand Up @@ -166,7 +166,7 @@ void shouldImmediatelyReturnWhenCallingTheProviderMutator() throws Exception {
return true;
});

verify(newProvider).initialize(any());
verify(newProvider, timeout(TIMEOUT)).initialize(any());
}

@Test
Expand Down Expand Up @@ -239,7 +239,7 @@ void shouldNotThrowExceptionIfProviderThrowsOneOnShutdown() {

assertThatCode(() -> setFeatureProvider(new NoOpProvider())).doesNotThrowAnyException();

verify(provider).shutdown();
verify(provider, timeout(TIMEOUT)).shutdown();
}
}

Expand All @@ -260,9 +260,9 @@ void shouldRunLambdasOnSuccessful() {

setFeatureProvider(featureProvider1, afterSet, afterInit, afterShutdown, afterError);
setFeatureProvider(featureProvider2);
verify(afterSet).accept(featureProvider1);
verify(afterInit).accept(featureProvider1);
verify(afterShutdown).accept(oldProvider);
verify(afterSet, timeout(TIMEOUT)).accept(featureProvider1);
verify(afterInit, timeout(TIMEOUT)).accept(featureProvider1);
verify(afterShutdown, timeout(TIMEOUT)).accept(oldProvider);
verify(afterError, never()).accept(any(), any());
}

Expand All @@ -278,7 +278,7 @@ void shouldRunLambdasOnError() throws Exception {
FeatureProvider errorFeatureProvider = createMockedErrorProvider();

setFeatureProvider(errorFeatureProvider, afterSet, afterInit, afterShutdown, afterError);
verify(afterSet).accept(errorFeatureProvider);
verify(afterSet, timeout(TIMEOUT)).accept(errorFeatureProvider);
verify(afterInit, never()).accept(any());;
verify(afterError, timeout(TIMEOUT)).accept(eq(errorFeatureProvider), any());
}
Expand Down

0 comments on commit 7eebd01

Please sign in to comment.