Skip to content

Commit 4d3d868

Browse files
authored
fix: Fix flaky SyncStreamQueueSourceTest test (#1419)
Signed-off-by: christian.lutnik <[email protected]>
1 parent 3bab9bc commit 4d3d868

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/resolver/process/storage/connector/sync/SyncStreamQueueSourceTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.concurrent.TimeUnit;
2828
import org.junit.jupiter.api.BeforeEach;
2929
import org.junit.jupiter.api.Test;
30-
import org.mockito.invocation.InvocationOnMock;
3130
import org.mockito.stubbing.Answer;
3231

3332
class SyncStreamQueueSourceTest {
@@ -48,13 +47,11 @@ public void init() throws Exception {
4847

4948
stub = mock(FlagSyncServiceStub.class);
5049
when(stub.withDeadlineAfter(anyLong(), any())).thenReturn(stub);
51-
doAnswer(new Answer<Void>() {
52-
public Void answer(InvocationOnMock invocation) {
53-
latch.countDown();
54-
Object[] args = invocation.getArguments();
55-
observer = (QueueingStreamObserver<SyncFlagsResponse>) args[1];
56-
return null;
57-
}
50+
doAnswer((Answer<Void>) invocation -> {
51+
Object[] args = invocation.getArguments();
52+
observer = (QueueingStreamObserver<SyncFlagsResponse>) args[1];
53+
latch.countDown();
54+
return null;
5855
})
5956
.when(stub)
6057
.syncFlags(any(SyncFlagsRequest.class), any(QueueingStreamObserver.class)); // Mock the initialize

0 commit comments

Comments
 (0)