diff --git a/src/test/org/apache/commons/lang/ArrayUtilsTest.java b/src/test/org/apache/commons/lang/ArrayUtilsTest.java index 94cc6361b..c531e51e0 100644 --- a/src/test/org/apache/commons/lang/ArrayUtilsTest.java +++ b/src/test/org/apache/commons/lang/ArrayUtilsTest.java @@ -60,13 +60,14 @@ import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + /** * Unit tests {@link org.apache.commons.lang.ArrayUtils}. * * @author Stephen Colebourne * @author Moritz Petersen * @author Nikolay Metchev - * @version $Id: ArrayUtilsTest.java,v 1.5 2003/02/04 22:06:24 scolebourne Exp $ + * @version $Id: ArrayUtilsTest.java,v 1.6 2003/03/23 21:47:30 scolebourne Exp $ */ public class ArrayUtilsTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/BooleanUtilsTest.java b/src/test/org/apache/commons/lang/BooleanUtilsTest.java index 3b14766a4..f420efdc2 100644 --- a/src/test/org/apache/commons/lang/BooleanUtilsTest.java +++ b/src/test/org/apache/commons/lang/BooleanUtilsTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,11 +57,12 @@ import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + /** * Unit tests {@link org.apache.commons.lang.BooleanUtils}. * * @author Stephen Colebourne - * @version $Id: BooleanUtilsTest.java,v 1.2 2002/12/22 21:33:12 scolebourne Exp $ + * @version $Id: BooleanUtilsTest.java,v 1.3 2003/03/23 21:47:30 scolebourne Exp $ */ public class BooleanUtilsTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/CharSetUtilsTest.java b/src/test/org/apache/commons/lang/CharSetUtilsTest.java index 05c5c60cb..4f84970a9 100644 --- a/src/test/org/apache/commons/lang/CharSetUtilsTest.java +++ b/src/test/org/apache/commons/lang/CharSetUtilsTest.java @@ -1,9 +1,7 @@ -package org.apache.commons.lang; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,17 +51,19 @@ * information on the Apache Software Foundation, please see * . */ +package org.apache.commons.lang; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + /** * Unit tests {@link org.apache.commons.lang.CharSetUtils}. * * @author Henri Yandell * @author Ringo De Smet - * @version $Id: CharSetUtilsTest.java,v 1.6 2003/03/23 05:50:51 bayard Exp $ + * @version $Id: CharSetUtilsTest.java,v 1.7 2003/03/23 21:47:30 scolebourne Exp $ */ public class CharSetUtilsTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/ClassUtilsTest.java b/src/test/org/apache/commons/lang/ClassUtilsTest.java index 635cacb04..ff73614fd 100644 --- a/src/test/org/apache/commons/lang/ClassUtilsTest.java +++ b/src/test/org/apache/commons/lang/ClassUtilsTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,11 +61,12 @@ import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + /** * Unit tests {@link org.apache.commons.lang.ClassUtils}. * * @author Stephen Colebourne - * @version $Id: ClassUtilsTest.java,v 1.2 2002/12/31 22:32:23 scolebourne Exp $ + * @version $Id: ClassUtilsTest.java,v 1.3 2003/03/23 21:47:30 scolebourne Exp $ */ public class ClassUtilsTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/LangTestSuite.java b/src/test/org/apache/commons/lang/LangTestSuite.java index 57a7945b6..e21464171 100644 --- a/src/test/org/apache/commons/lang/LangTestSuite.java +++ b/src/test/org/apache/commons/lang/LangTestSuite.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,12 +57,13 @@ import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + /** * Test suite for the Lang package. * * @author Stephen Colebourne * @author Ringo De Smet - * @version $Id: LangTestSuite.java,v 1.12 2002/12/29 22:09:53 scolebourne Exp $ + * @version $Id: LangTestSuite.java,v 1.13 2003/03/23 21:49:13 scolebourne Exp $ */ public class LangTestSuite extends TestCase { diff --git a/src/test/org/apache/commons/lang/NumberRangeTest.java b/src/test/org/apache/commons/lang/NumberRangeTest.java index 49e6a3d4b..4c6e8d4db 100644 --- a/src/test/org/apache/commons/lang/NumberRangeTest.java +++ b/src/test/org/apache/commons/lang/NumberRangeTest.java @@ -1,9 +1,7 @@ -package org.apache.commons.lang; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,18 +51,18 @@ * information on the Apache Software Foundation, please see * . */ +package org.apache.commons.lang; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; - /** * Test cases for the {@link NumberRange} class. * * @author Christopher Elkins * @author Ringo De Smet - * @version $Revision: 1.3 $ $Date: 2002/11/07 16:59:44 $ + * @version $Revision: 1.4 $ $Date: 2003/03/23 21:49:13 $ */ public final class NumberRangeTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/NumberUtilsTest.java b/src/test/org/apache/commons/lang/NumberUtilsTest.java index d4d82816a..e5368e33d 100644 --- a/src/test/org/apache/commons/lang/NumberUtilsTest.java +++ b/src/test/org/apache/commons/lang/NumberUtilsTest.java @@ -1,9 +1,7 @@ -package org.apache.commons.lang; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,6 +51,7 @@ * information on the Apache Software Foundation, please see * . */ +package org.apache.commons.lang; import java.lang.reflect.Method; import java.math.BigDecimal; @@ -61,12 +60,13 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; + /** * Unit tests {@link org.apache.commons.lang.NumberUtils}. * * @author Rand McNeely * @author Ringo De Smet - * @version $Id: NumberUtilsTest.java,v 1.4 2002/12/15 16:53:28 scolebourne Exp $ + * @version $Id: NumberUtilsTest.java,v 1.5 2003/03/23 21:49:13 scolebourne Exp $ */ public class NumberUtilsTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/ObjectUtilsTest.java b/src/test/org/apache/commons/lang/ObjectUtilsTest.java index 55dfc885d..114f675fa 100644 --- a/src/test/org/apache/commons/lang/ObjectUtilsTest.java +++ b/src/test/org/apache/commons/lang/ObjectUtilsTest.java @@ -1,9 +1,7 @@ -package org.apache.commons.lang; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,18 +51,20 @@ * information on the Apache Software Foundation, please see * . */ +package org.apache.commons.lang; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + /** * Unit tests {@link org.apache.commons.lang.ObjectUtils}. * * @author John McNally * @author Stephen Colebourne * @author Ringo De Smet - * @version $Id: ObjectUtilsTest.java,v 1.3 2002/09/18 20:12:15 scolebourne Exp $ + * @version $Id: ObjectUtilsTest.java,v 1.4 2003/03/23 21:49:13 scolebourne Exp $ */ public class ObjectUtilsTest extends TestCase { private static final String FOO = "foo"; diff --git a/src/test/org/apache/commons/lang/RandomStringUtilsTest.java b/src/test/org/apache/commons/lang/RandomStringUtilsTest.java index c3b479479..e5d154645 100644 --- a/src/test/org/apache/commons/lang/RandomStringUtilsTest.java +++ b/src/test/org/apache/commons/lang/RandomStringUtilsTest.java @@ -1,9 +1,7 @@ -package org.apache.commons.lang; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -18,21 +16,21 @@ * the documentation and/or other materials provided with the * distribution. * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Commons" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -53,6 +51,7 @@ * information on the Apache Software Foundation, please see * . */ +package org.apache.commons.lang; import java.util.Random; @@ -63,7 +62,7 @@ * * @author Steven Caswell * @author Ringo De Smet - * @version $Id: RandomStringUtilsTest.java,v 1.3 2003/02/02 03:46:13 bayard Exp $ + * @version $Id: RandomStringUtilsTest.java,v 1.4 2003/03/23 21:50:58 scolebourne Exp $ */ public class RandomStringUtilsTest extends junit.framework.TestCase { /** diff --git a/src/test/org/apache/commons/lang/SerializationUtilsTest.java b/src/test/org/apache/commons/lang/SerializationUtilsTest.java index 4c42ebb5b..f5c5c6515 100644 --- a/src/test/org/apache/commons/lang/SerializationUtilsTest.java +++ b/src/test/org/apache/commons/lang/SerializationUtilsTest.java @@ -1,9 +1,7 @@ -package org.apache.commons.lang; - /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,6 +51,7 @@ * information on the Apache Software Foundation, please see * . */ +package org.apache.commons.lang; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -70,7 +69,7 @@ * * @author Stephen Colebourne * @author Ringo De Smet - * @version $Id: SerializationUtilsTest.java,v 1.1 2002/07/19 03:35:55 bayard Exp $ + * @version $Id: SerializationUtilsTest.java,v 1.2 2003/03/23 21:50:58 scolebourne Exp $ */ public class SerializationUtilsTest extends TestCase { private String iString; diff --git a/src/test/org/apache/commons/lang/StringUtilsEqualsIndexOfTest.java b/src/test/org/apache/commons/lang/StringUtilsEqualsIndexOfTest.java index af2a78ef3..3dc4574c4 100644 --- a/src/test/org/apache/commons/lang/StringUtilsEqualsIndexOfTest.java +++ b/src/test/org/apache/commons/lang/StringUtilsEqualsIndexOfTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ * * @author Stephen Colebourne * @author Ringo De Smet - * @version $Id: StringUtilsEqualsIndexOfTest.java,v 1.1 2002/07/19 03:35:55 bayard Exp $ + * @version $Id: StringUtilsEqualsIndexOfTest.java,v 1.2 2003/03/23 21:50:58 scolebourne Exp $ */ public class StringUtilsEqualsIndexOfTest extends TestCase { private static final String FOO = "foo"; diff --git a/src/test/org/apache/commons/lang/StringUtilsIsTest.java b/src/test/org/apache/commons/lang/StringUtilsIsTest.java index f57ffd065..35c87b84b 100644 --- a/src/test/org/apache/commons/lang/StringUtilsIsTest.java +++ b/src/test/org/apache/commons/lang/StringUtilsIsTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,7 +62,7 @@ * Unit tests {@link org.apache.commons.lang.StringUtils} - Substring methods * * @author Stephen Colebourne - * @version $Id: StringUtilsIsTest.java,v 1.4 2002/12/15 16:54:23 scolebourne Exp $ + * @version $Id: StringUtilsIsTest.java,v 1.5 2003/03/23 21:51:51 scolebourne Exp $ */ public class StringUtilsIsTest extends TestCase { diff --git a/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java b/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java index 6e69e412b..d43d52188 100644 --- a/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java +++ b/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ * * @author Stephen Colebourne * @author Ringo De Smet - * @version $Id: StringUtilsSubstringTest.java,v 1.2 2002/11/27 22:53:48 bayard Exp $ + * @version $Id: StringUtilsSubstringTest.java,v 1.3 2003/03/23 21:51:19 scolebourne Exp $ */ public class StringUtilsSubstringTest extends TestCase { private static final String FOO = "foo"; diff --git a/src/test/org/apache/commons/lang/StringUtilsTest.java b/src/test/org/apache/commons/lang/StringUtilsTest.java index 0121fb0df..3895bed42 100644 --- a/src/test/org/apache/commons/lang/StringUtilsTest.java +++ b/src/test/org/apache/commons/lang/StringUtilsTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,7 +69,7 @@ * @author Henning P. Schmiedehausen - * @version $Id: StringUtilsTest.java,v 1.15 2003/03/23 05:26:23 bayard Exp $ + * @version $Id: StringUtilsTest.java,v 1.16 2003/03/23 21:51:19 scolebourne Exp $ */ public class StringUtilsTest extends TestCase { @@ -388,7 +388,32 @@ public void testGetLevenshteinDistance() { 1, StringUtils.getLevenshteinDistance("hello", "hallo") ); } - public void testContainsOnly() { + public void testContainsOnlyString() { + String str1 = "a"; + String str2 = "b"; + String str3 = "ab"; + String chars1= "b"; + String chars2= "a"; + String chars3= "ab"; + String emptyChars = ""; + assertEquals("containsOnly(null, null) failed", false, StringUtils.containsOnly(null, (String) null)); + assertEquals("containsOnly(empty-string, null) failed", false, StringUtils.containsOnly("", (String) null)); + assertEquals("containsOnly(null, empty-string) failed", false, StringUtils.containsOnly(null, emptyChars)); + assertEquals("containsOnly(str1, empty-char-array) failed", false, StringUtils.containsOnly(str1, emptyChars)); + assertEquals("containsOnly(empty-string, empty-char-array) failed", true, StringUtils.containsOnly("", emptyChars)); + assertEquals("containsOnly(empty-string, chars1) failed", true, StringUtils.containsOnly("", chars1)); + assertEquals("containsOnly(str1, chars1) failed", false, StringUtils.containsOnly(str1, chars1)); + assertEquals("containsOnly(str1, chars2) success", true, StringUtils.containsOnly(str1, chars2)); + assertEquals("containsOnly(str1, chars3) success", true, StringUtils.containsOnly(str1, chars3)); + assertEquals("containsOnly(str2, chars1) success", true, StringUtils.containsOnly(str2, chars1)); + assertEquals("containsOnly(str2, chars2) failed", false, StringUtils.containsOnly(str2, chars2)); + assertEquals("containsOnly(str2, chars3) success", true, StringUtils.containsOnly(str2, chars3)); + assertEquals("containsOnly(String3, chars1) failed", false, StringUtils.containsOnly(str3, chars1)); + assertEquals("containsOnly(String3, chars2) failed", false, StringUtils.containsOnly(str3, chars2)); + assertEquals("containsOnly(String3, chars3) success", true, StringUtils.containsOnly(str3, chars3)); + } + + public void testContainsOnlyCharArray() { String str1 = "a"; String str2 = "b"; String str3 = "ab"; @@ -396,24 +421,73 @@ public void testContainsOnly() { char[] chars2= {'a'}; char[] chars3= {'a', 'b'}; char[] emptyChars = new char[0]; - assertEquals("containsOnly(null, null) failed", false, StringUtils.containsOnly(null, null)); - assertEquals("containsOnly(empty-string, null) failed", false, StringUtils.containsOnly("", null)); + assertEquals("containsOnly(null, null) failed", false, StringUtils.containsOnly(null, (char[]) null)); + assertEquals("containsOnly(empty-string, null) failed", false, StringUtils.containsOnly("", (char[]) null)); assertEquals("containsOnly(null, empty-string) failed", false, StringUtils.containsOnly(null, emptyChars)); assertEquals("containsOnly(str1, empty-char-array) failed", false, StringUtils.containsOnly(str1, emptyChars)); assertEquals("containsOnly(empty-string, empty-char-array) failed", true, StringUtils.containsOnly("", emptyChars)); assertEquals("containsOnly(empty-string, chars1) failed", true, StringUtils.containsOnly("", chars1)); assertEquals("containsOnly(str1, chars1) failed", false, StringUtils.containsOnly(str1, chars1)); - assertEquals("containsOnly(str1, chars1) failed", false, StringUtils.containsOnly(str1, chars1)); - assertEquals("containsOnly(str1, chars1) success", true, StringUtils.containsOnly(str1, chars2)); - assertEquals("containsOnly(str1, chars1) success", true, StringUtils.containsOnly(str1, chars3)); - assertEquals("containsOnly(str2, chars2) success", true, StringUtils.containsOnly(str2, chars1)); + assertEquals("containsOnly(str1, chars2) success", true, StringUtils.containsOnly(str1, chars2)); + assertEquals("containsOnly(str1, chars3) success", true, StringUtils.containsOnly(str1, chars3)); + assertEquals("containsOnly(str2, chars1) success", true, StringUtils.containsOnly(str2, chars1)); assertEquals("containsOnly(str2, chars2) failed", false, StringUtils.containsOnly(str2, chars2)); - assertEquals("containsOnly(str2, chars2) success", true, StringUtils.containsOnly(str2, chars3)); - assertEquals("containsOnly(String3, chars3) failed", false, StringUtils.containsOnly(str3, chars1)); - assertEquals("containsOnly(String3, chars3) failed", false, StringUtils.containsOnly(str3, chars2)); + assertEquals("containsOnly(str2, chars3) success", true, StringUtils.containsOnly(str2, chars3)); + assertEquals("containsOnly(String3, chars1) failed", false, StringUtils.containsOnly(str3, chars1)); + assertEquals("containsOnly(String3, chars2) failed", false, StringUtils.containsOnly(str3, chars2)); assertEquals("containsOnly(String3, chars3) success", true, StringUtils.containsOnly(str3, chars3)); } + public void testContainsNoneString() { + String str1 = "a"; + String str2 = "b"; + String str3 = "ab."; + String chars1= "b"; + String chars2= "."; + String chars3= "cd"; + String emptyChars = ""; + assertEquals("containsNone(null, null) failed", true, StringUtils.containsNone(null, (String) null)); + assertEquals("containsNone(empty-string, null) failed", true, StringUtils.containsNone("", (String) null)); + assertEquals("containsNone(null, empty-string) failed", true, StringUtils.containsNone(null, emptyChars)); + assertEquals("containsNone(str1, empty-char-array) failed", true, StringUtils.containsNone(str1, emptyChars)); + assertEquals("containsNone(empty-string, empty-char-array) failed", true, StringUtils.containsNone("", emptyChars)); + assertEquals("containsNone(empty-string, chars1) failed", true, StringUtils.containsNone("", chars1)); + assertEquals("containsNone(str1, chars1)", true, StringUtils.containsNone(str1, chars1)); + assertEquals("containsNone(str1, chars2)", true, StringUtils.containsNone(str1, chars2)); + assertEquals("containsNone(str1, chars3)", true, StringUtils.containsNone(str1, chars3)); + assertEquals("containsNone(str2, chars1)", false, StringUtils.containsNone(str2, chars1)); + assertEquals("containsNone(str2, chars2)", true, StringUtils.containsNone(str2, chars2)); + assertEquals("containsNone(str2, chars3)", true, StringUtils.containsNone(str2, chars3)); + assertEquals("containsNone(str3, chars1)", false, StringUtils.containsNone(str3, chars1)); + assertEquals("containsNone(str3, chars2)", false, StringUtils.containsNone(str3, chars2)); + assertEquals("containsNone(str3, chars3)", true, StringUtils.containsNone(str3, chars3)); + } + + public void testContainsNoneCharArray() { + String str1 = "a"; + String str2 = "b"; + String str3 = "ab."; + char[] chars1= {'b'}; + char[] chars2= {'.'}; + char[] chars3= {'c', 'd'}; + char[] emptyChars = new char[0]; + assertEquals("containsNone(null, null) failed", true, StringUtils.containsNone(null, (char[]) null)); + assertEquals("containsNone(empty-string, null) failed", true, StringUtils.containsNone("", (char[]) null)); + assertEquals("containsNone(null, empty-string) failed", true, StringUtils.containsNone(null, emptyChars)); + assertEquals("containsNone(str1, empty-char-array) failed", true, StringUtils.containsNone(str1, emptyChars)); + assertEquals("containsNone(empty-string, empty-char-array) failed", true, StringUtils.containsNone("", emptyChars)); + assertEquals("containsNone(empty-string, chars1) failed", true, StringUtils.containsNone("", chars1)); + assertEquals("containsNone(str1, chars1)", true, StringUtils.containsNone(str1, chars1)); + assertEquals("containsNone(str1, chars2)", true, StringUtils.containsNone(str1, chars2)); + assertEquals("containsNone(str1, chars3)", true, StringUtils.containsNone(str1, chars3)); + assertEquals("containsNone(str2, chars1)", false, StringUtils.containsNone(str2, chars1)); + assertEquals("containsNone(str2, chars2)", true, StringUtils.containsNone(str2, chars2)); + assertEquals("containsNone(str2, chars3)", true, StringUtils.containsNone(str2, chars3)); + assertEquals("containsNone(str3, chars1)", false, StringUtils.containsNone(str3, chars1)); + assertEquals("containsNone(str3, chars2)", false, StringUtils.containsNone(str3, chars2)); + assertEquals("containsNone(str3, chars3)", true, StringUtils.containsNone(str3, chars3)); + } + public void testAbbreviate() { assertEquals("abbreviate(String,int) failed", diff --git a/src/test/org/apache/commons/lang/StringUtilsTrimEmptyTest.java b/src/test/org/apache/commons/lang/StringUtilsTrimEmptyTest.java index 92a057609..fa1c1ae8e 100644 --- a/src/test/org/apache/commons/lang/StringUtilsTrimEmptyTest.java +++ b/src/test/org/apache/commons/lang/StringUtilsTrimEmptyTest.java @@ -1,7 +1,7 @@ /* ==================================================================== * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ * * @author Stephen Colebourne * @author Ringo De Smet - * @version $Id: StringUtilsTrimEmptyTest.java,v 1.5 2002/09/27 06:08:16 bayard Exp $ + * @version $Id: StringUtilsTrimEmptyTest.java,v 1.6 2003/03/23 21:51:19 scolebourne Exp $ */ public class StringUtilsTrimEmptyTest extends TestCase { private static final String FOO = "foo";