@@ -101,6 +101,9 @@ void testAbbreviate_StringIntInt() {
101101 assertAbbreviateWithOffset ("...ijklmno" , 15 , 10 );
102102 assertAbbreviateWithOffset ("...ijklmno" , 16 , 10 );
103103 assertAbbreviateWithOffset ("...ijklmno" , Integer .MAX_VALUE , 10 );
104+
105+ // abbreviating a shorter string allows maxWidth < 7
106+ assertEquals ("...efg" , StringUtils .abbreviate ("abcdefg" , 5 , 6 ));
104107 }
105108
106109 @ Test
@@ -157,6 +160,10 @@ void testAbbreviate_StringStringIntInt() {
157160 assertAbbreviateWithAbbrevMarkerAndOffset ("999ijklmno" , "999" , 15 , 10 );
158161 assertAbbreviateWithAbbrevMarkerAndOffset ("_ghijklmno" , "_" , 16 , 10 );
159162 assertAbbreviateWithAbbrevMarkerAndOffset ("+ghijklmno" , "+" , Integer .MAX_VALUE , 10 );
163+
164+ // abbreviating a shorter string allows maxWidth < abbrevMarker.length * 2 + 1
165+ assertEquals ("..de" , StringUtils .abbreviate ("abcde" , ".." , 4 , 4 ));
166+ assertEquals ("....fg" , StringUtils .abbreviate ("abcdefg" , "...." , 5 , 6 ));
160167 }
161168
162169 // Fixed LANG-1463
0 commit comments