Skip to content

Commit

Permalink
Fix two unit tests failing locally
Browse files Browse the repository at this point in the history
Fixes JanusGraph#4139

Signed-off-by: Clement de Groc <clement.degroc@datadoghq.com>
  • Loading branch information
cdegroc authored and porunov committed Nov 30, 2023
1 parent 1c55bcd commit abdc113
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,11 @@ public void shouldFailMapUnwrapWithSuppressedExceptions() {
otherFuture.completeExceptionally(new IllegalArgumentException());
futureMap.put(new Object(), otherFuture);
}
ExecutionException executionException = Assertions.assertThrows(ExecutionException.class, () -> unwrap(futureMap));
Assertions.assertTrue(executionException.getCause() instanceof IllegalStateException);
Throwable[] suppressedExceptions = executionException.getSuppressed();
IllegalStateException exception = Assertions.assertThrows(IllegalStateException.class, () -> unwrap(futureMap));
Throwable[] suppressedExceptions = exception.getSuppressed();
Assertions.assertEquals(10, suppressedExceptions.length);
for(int i=0; i<10; i++){
Assertions.assertTrue(suppressedExceptions[i] instanceof ExecutionException &&
suppressedExceptions[i].getCause() instanceof IllegalArgumentException);
Assertions.assertTrue(suppressedExceptions[i] instanceof IllegalArgumentException);
}
}

Expand All @@ -154,13 +152,11 @@ public void shouldFailCollectionAwaitWithSuppressedExceptions() {
otherFuture.completeExceptionally(new IllegalArgumentException());
futureList.add(otherFuture);
}
ExecutionException executionException = Assertions.assertThrows(ExecutionException.class, () -> awaitAll(futureList));
Assertions.assertTrue(executionException.getCause() instanceof IllegalStateException);
Throwable[] suppressedExceptions = executionException.getSuppressed();
IllegalStateException exception = Assertions.assertThrows(IllegalStateException.class, () -> awaitAll(futureList));
Throwable[] suppressedExceptions = exception.getSuppressed();
Assertions.assertEquals(10, suppressedExceptions.length);
for(int i=0; i<10; i++){
Assertions.assertTrue(suppressedExceptions[i] instanceof ExecutionException &&
suppressedExceptions[i].getCause() instanceof IllegalArgumentException);
Assertions.assertTrue(suppressedExceptions[i] instanceof IllegalArgumentException);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import java.util.Map;
import java.util.Optional;

import static org.mockito.ArgumentMatchers.anyCollection;

public class MultiQueriableStepBatchFetcherTest {

private Vertex mockVertex;
Expand All @@ -46,7 +48,7 @@ public void setupMocks(){
Mockito.doReturn(traversal).when(traversal).asAdmin();
Mockito.doReturn(Optional.of(tx)).when(traversal).getGraph();
Mockito.doReturn(true).when(tx).isOpen();
Mockito.doReturn(multiQuery).when(tx).multiQuery();
Mockito.doReturn(multiQuery).when(tx).multiQuery(anyCollection());
}

@Test
Expand Down

0 comments on commit abdc113

Please sign in to comment.