File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/test/java/org/apache/commons/lang3 Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -584,6 +584,15 @@ public void test_getShortCanonicalName_String() {
584584 assertEquals ("String[]" , ClassUtils .getShortCanonicalName (String [].class .getName ()));
585585 assertEquals ("String[]" , ClassUtils .getShortCanonicalName (String [].class .getCanonicalName ()));
586586 assertEquals ("String[]" , ClassUtils .getShortCanonicalName ("String[]" ));
587+ // Note that we throw RuntimeException (but not which one) for the following bad inputs:
588+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("" ));
589+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("[" ));
590+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("[]" ));
591+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("[;" ));
592+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("[];" ));
593+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName (" " ));
594+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("[$" ));
595+ assertThrows (RuntimeException .class , () -> ClassUtils .getShortCanonicalName ("[$a" ));
587596 }
588597
589598 @ Test
You can’t perform that action at this time.
0 commit comments