diff --git a/pic-sure-resources/pic-sure-visualization-resource/src/test/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/VisualizationUtilTests.java b/pic-sure-resources/pic-sure-visualization-resource/src/test/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/VisualizationUtilTests.java index 3c48afcb..076cbf1e 100644 --- a/pic-sure-resources/pic-sure-visualization-resource/src/test/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/VisualizationUtilTests.java +++ b/pic-sure-resources/pic-sure-visualization-resource/src/test/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/VisualizationUtilTests.java @@ -9,18 +9,25 @@ public class VisualizationUtilTests { - @Test - @DisplayName("Test limitKeySize") - public void testLimitKeySizeUniqueness() { - // Testing name uniqueness - Map 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 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 stringIntegerMap = VisualizationUtil.limitKeySize(axisMap); - assert (stringIntegerMap.size() == 4); - } + Map actual = VisualizationUtil.limitKeySize(axisMap); + + Map 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); + } }