From f9ca0651425cdced7fdbe80b1df12734573fbe17 Mon Sep 17 00:00:00 2001 From: Gcolon021 <34667267+Gcolon021@users.noreply.github.com> Date: Thu, 8 Feb 2024 12:37:59 -0500 Subject: [PATCH] Update pic-sure-resources/pic-sure-visualization-resource/src/test/java/edu/harvard/hms/dbmi/avillach/resource/visualization/service/VisualizationUtilTests.java Co-authored-by: Luke Sikina --- .../service/VisualizationUtilTests.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) 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); + } }