From 67d608a5499a473935041ec7d0760d062a6d1244 Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Fri, 17 Sep 2021 16:36:48 +0100 Subject: [PATCH] gh-2421: Changed GetElementsIT to test both seed and element input --- .../integration/impl/GetElementsIT.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/integration-test/src/test/java/uk/gov/gchq/gaffer/integration/impl/GetElementsIT.java b/integration-test/src/test/java/uk/gov/gchq/gaffer/integration/impl/GetElementsIT.java index 7e1c0f5a156..ba5e43a2272 100644 --- a/integration-test/src/test/java/uk/gov/gchq/gaffer/integration/impl/GetElementsIT.java +++ b/integration-test/src/test/java/uk/gov/gchq/gaffer/integration/impl/GetElementsIT.java @@ -56,6 +56,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; import static org.assertj.core.api.Assertions.assertThat; import static uk.gov.gchq.gaffer.operation.SeedMatching.SeedMatchingType; @@ -546,7 +548,7 @@ private void shouldGetElements(final Collection expectedElements, viewBuilder.edge(TestGroups.EDGE); } - final GetElements op = new GetElements.Builder() + final GetElements opSeed = new GetElements.Builder() .input(seeds) .directedType(directedType) .inOutType(inOutType) @@ -554,11 +556,24 @@ private void shouldGetElements(final Collection expectedElements, .seedMatching(seedMatching) .build(); + Collection seedCollection = StreamSupport.stream(seeds.spliterator(), false) + .collect(Collectors.toList()); + + final GetElements opElement = new GetElements.Builder() + .input(getElements(seedCollection, null)) + .directedType(directedType) + .inOutType(inOutType) + .view(viewBuilder.build()) + .seedMatching(seedMatching) + .build(); + // When - final CloseableIterable results = graph.execute(op, user); + final CloseableIterable resultsSeed = graph.execute(opSeed, user); + final CloseableIterable resultsElement = graph.execute(opElement, user); // Then - ElementUtil.assertElementEquals(expectedElements, results, true); + ElementUtil.assertElementEquals(expectedElements, resultsSeed, true); + ElementUtil.assertElementEquals(expectedElements, resultsElement, true); } private static Collection getElements(final Collection seeds, final Boolean direction) {