Skip to content

Commit

Permalink
Update pic-sure-resources/pic-sure-visualization-resource/src/test/ja…
Browse files Browse the repository at this point in the history
…va/edu/harvard/hms/dbmi/avillach/resource/visualization/service/VisualizationUtilTests.java

Co-authored-by: Luke Sikina <[email protected]>
  • Loading branch information
Gcolon021 and Luke-Sikina authored Feb 8, 2024
1 parent 1f4778f commit f9ca065
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@

public class VisualizationUtilTests {

@Test
@DisplayName("Test limitKeySize")
public void testLimitKeySizeUniqueness() {
// Testing name uniqueness
Map<String, Integer> axisMap = new HashMap<>();
axisMap.put("Disease-Specific (Asthma, Allergy and Inflammation, PUB)", 1);
axisMap.put("Disease-Specific (Asthma, Allergy and Inflammation, PUB, NPU)", 1);
axisMap.put("Disease-Specific (Asthma, Allergy and Inflammation, NPU)", 1);
axisMap.put("Disease-Specific (Asthma, Allergy and Inflammation)", 1);
@Test
@DisplayName("Test limitKeySize")
public void testLimitKeySizeUniqueness() {
Map<String, Integer> axisMap = new HashMap<>(Map.of(
"Disease-Specific (Asthma, Allergy and Inflammation, PUB)", 1,
"Disease-Specific (Asthma, Allergy and Inflammation, PUB, NPU)", 1,
"Disease-Specific (Asthma, Allergy and Inflammation, NPU)", 1,
"Disease-Specific (Asthma, Allergy and Inflammation)", 1
));

Map<String, Integer> stringIntegerMap = VisualizationUtil.limitKeySize(axisMap);
assert (stringIntegerMap.size() == 4);
}
Map<String, Integer> actual = VisualizationUtil.limitKeySize(axisMap);

Map<String, Integer> expected = Map.of(
"Disease-Specific (Asthma, Allergy an..., PUB)", 1,
"Disease-Specific (Asthma, Allergy an...ation)", 1,
"Disease-Specific (Asthma, Allergy an..., NPU)", 1,
"Disease-Specific (Asthma, Allergy a...B, NPU)", 1
);
assertEquals(expected, actual);
}

}

0 comments on commit f9ca065

Please sign in to comment.