You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2002/11/27 23:53:48 UTC
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang StringUtilsSubstringTest.java
bayard 2002/11/27 14:53:48
Modified: lang/src/test/org/apache/commons/lang
StringUtilsSubstringTest.java
Log:
Added a unit test to show the bugs in bug #14883 for countMatches method
Revision Changes Path
1.2 +13 -1 jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java
Index: StringUtilsSubstringTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StringUtilsSubstringTest.java 19 Jul 2002 03:35:55 -0000 1.1
+++ StringUtilsSubstringTest.java 27 Nov 2002 22:53:48 -0000 1.2
@@ -192,6 +192,18 @@
}
public void testCountMatches() {
+ try {
+ assertEquals(-1,
+ StringUtils.countMatches(null, null));
+ throw new RuntimeException("Should have thrown a NullPointerException. ");
+ } catch(NullPointerException npe) {
+ }
+
+ assertEquals(0,
+ StringUtils.countMatches("x", "") );
+ assertEquals(0,
+ StringUtils.countMatches("", "") );
+
assertEquals(3,
StringUtils.countMatches("one long someone sentence of one", "one"));
assertEquals(0,
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>