Remove trailing whitespace
This commit is contained in:
parent
629a83c6c4
commit
984be03374
|
@ -327,58 +327,58 @@ public void testSubstringBetween_StringString() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSubstringsBetween_StringStringString() {
|
public void testSubstringsBetween_StringStringString() {
|
||||||
|
|
||||||
String[] results = StringUtils.substringsBetween("[one], [two], [three]", "[", "]");
|
String[] results = StringUtils.substringsBetween("[one], [two], [three]", "[", "]");
|
||||||
assertEquals(3, results.length);
|
assertEquals(3, results.length);
|
||||||
assertEquals("one", results[0]);
|
assertEquals("one", results[0]);
|
||||||
assertEquals("two", results[1]);
|
assertEquals("two", results[1]);
|
||||||
assertEquals("three", results[2]);
|
assertEquals("three", results[2]);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one], [two], three", "[", "]");
|
results = StringUtils.substringsBetween("[one], [two], three", "[", "]");
|
||||||
assertEquals(2, results.length);
|
assertEquals(2, results.length);
|
||||||
assertEquals("one", results[0]);
|
assertEquals("one", results[0]);
|
||||||
assertEquals("two", results[1]);
|
assertEquals("two", results[1]);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one], [two], three]", "[", "]");
|
results = StringUtils.substringsBetween("[one], [two], three]", "[", "]");
|
||||||
assertEquals(2, results.length);
|
assertEquals(2, results.length);
|
||||||
assertEquals("one", results[0]);
|
assertEquals("one", results[0]);
|
||||||
assertEquals("two", results[1]);
|
assertEquals("two", results[1]);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one], two], three]", "[", "]");
|
results = StringUtils.substringsBetween("[one], two], three]", "[", "]");
|
||||||
assertEquals(1, results.length);
|
assertEquals(1, results.length);
|
||||||
assertEquals("one", results[0]);
|
assertEquals("one", results[0]);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("one], two], [three]", "[", "]");
|
results = StringUtils.substringsBetween("one], two], [three]", "[", "]");
|
||||||
assertEquals(1, results.length);
|
assertEquals(1, results.length);
|
||||||
assertEquals("three", results[0]);
|
assertEquals("three", results[0]);
|
||||||
|
|
||||||
// 'ab hello ba' will match, but 'ab non ba' won't
|
// 'ab hello ba' will match, but 'ab non ba' won't
|
||||||
// this is because the 'a' is shared between the two and can't be matched twice
|
// this is because the 'a' is shared between the two and can't be matched twice
|
||||||
results = StringUtils.substringsBetween("aabhellobabnonba", "ab", "ba");
|
results = StringUtils.substringsBetween("aabhellobabnonba", "ab", "ba");
|
||||||
assertEquals(1, results.length);
|
assertEquals(1, results.length);
|
||||||
assertEquals("hello", results[0]);
|
assertEquals("hello", results[0]);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("one, two, three", "[", "]");
|
results = StringUtils.substringsBetween("one, two, three", "[", "]");
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one, two, three", "[", "]");
|
results = StringUtils.substringsBetween("[one, two, three", "[", "]");
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("one, two, three]", "[", "]");
|
results = StringUtils.substringsBetween("one, two, three]", "[", "]");
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one], [two], [three]", "[", null);
|
results = StringUtils.substringsBetween("[one], [two], [three]", "[", null);
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one], [two], [three]", null, "]");
|
results = StringUtils.substringsBetween("[one], [two], [three]", null, "]");
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("[one], [two], [three]", "", "");
|
results = StringUtils.substringsBetween("[one], [two], [three]", "", "");
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween(null, "[", "]");
|
results = StringUtils.substringsBetween(null, "[", "]");
|
||||||
assertNull(results);
|
assertNull(results);
|
||||||
|
|
||||||
results = StringUtils.substringsBetween("", "[", "]");
|
results = StringUtils.substringsBetween("", "[", "]");
|
||||||
assertEquals(0, results.length);
|
assertEquals(0, results.length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue