diff --git a/src/test/java/org/gcube/common/clients/AsyncDelegateTest.java b/src/test/java/org/gcube/common/clients/AsyncDelegateTest.java index 861dcbb..288bbf6 100644 --- a/src/test/java/org/gcube/common/clients/AsyncDelegateTest.java +++ b/src/test/java/org/gcube/common/clients/AsyncDelegateTest.java @@ -191,7 +191,7 @@ public class AsyncDelegateTest { Future future = delegate.makeAsync(call,callback); //make sure we test after call has been delivered - latch.await(1, SECONDS); + latch.await(5, SECONDS); verify(callback).done(value); @@ -217,8 +217,6 @@ public class AsyncDelegateTest { Callback callback = mock(Callback.class); when(callback.timeout()).thenReturn(50L); - Future future = delegate.makeAsync(call,callback); - final CountDownLatch latch = new CountDownLatch(1); Answer unblock = new Answer() { @@ -230,9 +228,11 @@ public class AsyncDelegateTest { }; doAnswer(unblock).when(callback).onFailure(any(TimeoutException.class)); + + Future future = delegate.makeAsync(call,callback); //makes sure callback has been invoked - latch.await(1,SECONDS); + latch.await(5,SECONDS); assertTrue(future.isCancelled()); }