From: Juergen H. <jho...@us...> - 2008-10-22 10:16:57
|
Update of /cvsroot/springframework/spring/test/org/springframework/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22385/test/org/springframework/util Modified Files: StringUtilsTests.java Log Message: fixed "StringUtils.delete" to prevent an eternal loop in case of the pattern being empty Index: StringUtilsTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/util/StringUtilsTests.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** StringUtilsTests.java 30 Jul 2008 11:01:44 -0000 1.19 --- StringUtilsTests.java 22 Oct 2008 09:44:15 -0000 1.20 *************** *** 196,199 **** --- 196,202 ---- String mismatch = StringUtils.delete(inString, "dxxcxcxog"); assertTrue("Result is unchanged", mismatch.equals(inString)); + + String nochange = StringUtils.delete(inString, ""); + assertTrue("Result is unchanged", nochange.equals(inString)); } *************** *** 202,217 **** String res = StringUtils.deleteAny(inString, "I"); ! assertTrue("Result has no Is [" + res + "]", ! res.equals("Able was ere saw Elba")); res = StringUtils.deleteAny(inString, "AeEba!"); ! assertTrue("Result has no Is [" + res + "]", ! res.equals("l ws I r I sw l")); String mismatch = StringUtils.deleteAny(inString, "#@$#$^"); assertTrue("Result is unchanged", mismatch.equals(inString)); ! String whitespace = ! "This is\n\n\n \t a messagy string with whitespace\n"; assertTrue("Has CR", whitespace.indexOf("\n") != -1); assertTrue("Has tab", whitespace.indexOf("\t") != -1); --- 205,217 ---- String res = StringUtils.deleteAny(inString, "I"); ! assertTrue("Result has no Is [" + res + "]", res.equals("Able was ere saw Elba")); res = StringUtils.deleteAny(inString, "AeEba!"); ! assertTrue("Result has no Is [" + res + "]", res.equals("l ws I r I sw l")); String mismatch = StringUtils.deleteAny(inString, "#@$#$^"); assertTrue("Result is unchanged", mismatch.equals(inString)); ! String whitespace = "This is\n\n\n \t a messagy string with whitespace\n"; assertTrue("Has CR", whitespace.indexOf("\n") != -1); assertTrue("Has tab", whitespace.indexOf("\t") != -1); |