Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ALS-5787] Open Access StatViz is not showing "Other" (#180)
* Update key length handling in limitKeySize The limitKeySize method in the VisualizationUtil class has been updated to ensure key uniqueness when keys exceed a certain length. A more robust method of shortening the keys has been implemented: if the key is longer than 45 characters, it is cut off and replaced with "..." and additional characters are appended to ensure uniqueness if needed. This helps limit key size while preserving uniqueness. * Add VisualizationUtilTests and refine key shortening logic Added a new test class, VisualizationUtilTests to validate the functionality of the VisualizationUtil class. Adjusted the 'limitKeySize' method to ensure key uniqueness when keys are shortened to a maximum length of 45 characters. If shortened keys are not unique, additional trailing characters are included until uniqueness is achieved. * Add check on length before substring * Update pic-sure-util/src/main/java/edu/harvard/dbmi/avillach/util/VisualizationUtil.java * Update pic-sure-util/src/main/java/edu/harvard/dbmi/avillach/util/VisualizationUtil.java * Update pic-sure-util/src/main/java/edu/harvard/dbmi/avillach/util/VisualizationUtil.java * 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 <lucas.sikina@gmail.com> * Fix import for modified unit test * Refactor and add test cases for key size limiting function Refactors existing code by simplifying key size limiting logic in VisualizationUtil and added several new unit tests to ensure its correct behavior with different input scenarios including long keys, empty maps, null maps, and uniqueness near middle. * Update null handling in VisualizationUtil's limitKeySize Changed the handling of null input in VisualizationUtil's limitKeySize from returning a new HashMap to throwing an IllegalArgumentException. Also, updated the corresponding test to check for this exception instead of comparing with an empty map. --------- Co-authored-by: Luke Sikina <lucas.sikina@gmail.com>
- Loading branch information