Skip to content

Commit

Permalink
Issue #2162 - use Set instead of List in closure unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
  • Loading branch information
JohnTimm committed Apr 6, 2021
1 parent f7ed8ac commit 37670d8
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,11 @@ public void testHasConcept() {
public void testClosure1() {
Set<Concept> concepts = provider.closure(codeSystem, Code.of("d"));

List<String> actual = concepts.stream()
Set<String> actual = concepts.stream()
.map(concept -> concept.getCode().getValue())
.collect(Collectors.toList());
.collect(Collectors.toSet());

List<String> expected = Arrays.asList("d", "q", "r", "s");
Set<String> expected = new HashSet<>(Arrays.asList("d", "q", "r", "s"));

Assert.assertEquals(actual, expected);
}
Expand All @@ -738,17 +738,17 @@ public void testClosure2() {

Map<Code, Set<Concept>> closureMap = provider.closure(codeSystem, new HashSet<>(Arrays.asList(code1, code2)));

List<String> actual1 = closureMap.get(code1).stream()
Set<String> actual1 = closureMap.get(code1).stream()
.map(concept -> concept.getCode().getValue())
.collect(Collectors.toList());
.collect(Collectors.toSet());

List<String> expected1 = Arrays.asList("c", "o", "p");
Set<String> expected1 = new HashSet<>(Arrays.asList("c", "o", "p"));

List<String> actual2 = closureMap.get(code2).stream()
Set<String> actual2 = closureMap.get(code2).stream()
.map(concept -> concept.getCode().getValue())
.collect(Collectors.toList());
.collect(Collectors.toSet());

List<String> expected2 = Arrays.asList("d", "q", "r", "s");
Set<String> expected2 = new HashSet<>(Arrays.asList("d", "q", "r", "s"));

Assert.assertEquals(actual1, expected1);
Assert.assertEquals(actual2, expected2);
Expand Down

0 comments on commit 37670d8

Please sign in to comment.