@@ -138,6 +138,56 @@ public void testTrimTrailingCharacter() {
138138 assertEquals (" a b c" , StringUtils .trimTrailingCharacter (" a b c " , ' ' ));
139139 }
140140
141+ @ Test
142+ public void testStartsWithIgnoreCase () {
143+ String suffix = "fOo" ;
144+ assertTrue (StringUtils .startsWithIgnoreCase ("foo" , suffix ));
145+ assertTrue (StringUtils .startsWithIgnoreCase ("Foo" , suffix ));
146+ assertTrue (StringUtils .startsWithIgnoreCase ("foobar" , suffix ));
147+ assertTrue (StringUtils .startsWithIgnoreCase ("foobarbar" , suffix ));
148+ assertTrue (StringUtils .startsWithIgnoreCase ("Foobar" , suffix ));
149+ assertTrue (StringUtils .startsWithIgnoreCase ("FoobarBar" , suffix ));
150+ assertTrue (StringUtils .startsWithIgnoreCase ("foObar" , suffix ));
151+ assertTrue (StringUtils .startsWithIgnoreCase ("FOObar" , suffix ));
152+ assertTrue (StringUtils .startsWithIgnoreCase ("fOobar" , suffix ));
153+ assertFalse (StringUtils .startsWithIgnoreCase (null , suffix ));
154+ assertFalse (StringUtils .startsWithIgnoreCase ("fOobar" , null ));
155+ assertFalse (StringUtils .startsWithIgnoreCase ("b" , suffix ));
156+ }
157+
158+ @ Test
159+ public void testEndsWithIgnoreCase () {
160+ String suffix = "fOo" ;
161+ assertTrue (StringUtils .endsWithIgnoreCase ("foo" , suffix ));
162+ assertTrue (StringUtils .endsWithIgnoreCase ("Foo" , suffix ));
163+ assertTrue (StringUtils .endsWithIgnoreCase ("barfoo" , suffix ));
164+ assertTrue (StringUtils .endsWithIgnoreCase ("barbarfoo" , suffix ));
165+ assertTrue (StringUtils .endsWithIgnoreCase ("barFoo" , suffix ));
166+ assertTrue (StringUtils .endsWithIgnoreCase ("barBarFoo" , suffix ));
167+ assertTrue (StringUtils .endsWithIgnoreCase ("barfoO" , suffix ));
168+ assertTrue (StringUtils .endsWithIgnoreCase ("barFOO" , suffix ));
169+ assertTrue (StringUtils .endsWithIgnoreCase ("barfOo" , suffix ));
170+ assertFalse (StringUtils .endsWithIgnoreCase (null , suffix ));
171+ assertFalse (StringUtils .endsWithIgnoreCase ("barfOo" , null ));
172+ assertFalse (StringUtils .endsWithIgnoreCase ("b" , suffix ));
173+ }
174+
175+ @ Test
176+ public void testSubstringMatch () {
177+ assertTrue (StringUtils .substringMatch ("foo" , 0 , "foo" ));
178+ assertTrue (StringUtils .substringMatch ("foo" , 1 , "oo" ));
179+ assertTrue (StringUtils .substringMatch ("foo" , 2 , "o" ));
180+ assertFalse (StringUtils .substringMatch ("foo" , 0 , "fOo" ));
181+ assertFalse (StringUtils .substringMatch ("foo" , 1 , "fOo" ));
182+ assertFalse (StringUtils .substringMatch ("foo" , 2 , "fOo" ));
183+ assertFalse (StringUtils .substringMatch ("foo" , 3 , "fOo" ));
184+ assertFalse (StringUtils .substringMatch ("foo" , 1 , "Oo" ));
185+ assertFalse (StringUtils .substringMatch ("foo" , 2 , "Oo" ));
186+ assertFalse (StringUtils .substringMatch ("foo" , 3 , "Oo" ));
187+ assertFalse (StringUtils .substringMatch ("foo" , 2 , "O" ));
188+ assertFalse (StringUtils .substringMatch ("foo" , 3 , "O" ));
189+ }
190+
141191 @ Test
142192 public void testCountOccurrencesOf () {
143193 assertTrue ("nullx2 = 0" ,
@@ -579,23 +629,6 @@ private void doTestCommaDelimitedListToStringArrayLegalMatch(String[] components
579629 assertTrue ("Output equals input" , Arrays .equals (sa , components ));
580630 }
581631
582- @ Test
583- public void testEndsWithIgnoreCase () {
584- String suffix = "fOo" ;
585- assertTrue (StringUtils .endsWithIgnoreCase ("foo" , suffix ));
586- assertTrue (StringUtils .endsWithIgnoreCase ("Foo" , suffix ));
587- assertTrue (StringUtils .endsWithIgnoreCase ("barfoo" , suffix ));
588- assertTrue (StringUtils .endsWithIgnoreCase ("barbarfoo" , suffix ));
589- assertTrue (StringUtils .endsWithIgnoreCase ("barFoo" , suffix ));
590- assertTrue (StringUtils .endsWithIgnoreCase ("barBarFoo" , suffix ));
591- assertTrue (StringUtils .endsWithIgnoreCase ("barfoO" , suffix ));
592- assertTrue (StringUtils .endsWithIgnoreCase ("barFOO" , suffix ));
593- assertTrue (StringUtils .endsWithIgnoreCase ("barfOo" , suffix ));
594- assertFalse (StringUtils .endsWithIgnoreCase (null , suffix ));
595- assertFalse (StringUtils .endsWithIgnoreCase ("barfOo" , null ));
596- assertFalse (StringUtils .endsWithIgnoreCase ("b" , suffix ));
597- }
598-
599632
600633 @ Test
601634 public void testParseLocaleStringSunnyDay () {
0 commit comments