removed tabs from source, as per checkstyle
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@151296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bb99d6906b
commit
413cd09a61
|
@ -170,7 +170,7 @@ public class ClassUtils {
|
|||
* <p>Gets the package name from a <code>String</code>.</p>
|
||||
*
|
||||
* <p>The string passed in is assumed to be a class name - it is not checked.</p>
|
||||
* <p>If the class is unpackaged, return an empty string.</p>
|
||||
* <p>If the class is unpackaged, return an empty string.</p>
|
||||
*
|
||||
* @param className the className to get the package name for, may be <code>null</code>
|
||||
* @return the package name or an empty string
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
|||
* @author Gary Gregory
|
||||
* @author Norm Deane
|
||||
* @since 2.0
|
||||
* @version $Id: Validate.java,v 1.13 2004/10/08 21:44:41 scolebourne Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Validate {
|
||||
// Validate has no dependencies on other classes in Commons Lang at present
|
||||
|
@ -508,13 +508,13 @@ public class Validate {
|
|||
* @since 2.1
|
||||
*/
|
||||
public static void allElementsOfType(Collection collection, Class clazz, String message) {
|
||||
Validate.notNull(collection);
|
||||
Validate.notNull(collection);
|
||||
Validate.notNull(clazz);
|
||||
for (Iterator it = collection.iterator(); it.hasNext(); ) {
|
||||
if (clazz.isInstance(it.next()) == false) {
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
for (Iterator it = collection.iterator(); it.hasNext(); ) {
|
||||
if (clazz.isInstance(it.next()) == false) {
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -533,15 +533,15 @@ public class Validate {
|
|||
* @since 2.1
|
||||
*/
|
||||
public static void allElementsOfType(Collection collection, Class clazz) {
|
||||
Validate.notNull(collection);
|
||||
Validate.notNull(collection);
|
||||
Validate.notNull(clazz);
|
||||
int i = 0;
|
||||
for (Iterator it = collection.iterator(); it.hasNext(); i++) {
|
||||
int i = 0;
|
||||
for (Iterator it = collection.iterator(); it.hasNext(); i++) {
|
||||
if (clazz.isInstance(it.next()) == false) {
|
||||
throw new IllegalArgumentException("The validated collection contains an element not of type "
|
||||
throw new IllegalArgumentException("The validated collection contains an element not of type "
|
||||
+ clazz.getName() + " at index: " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ import java.util.ListIterator;
|
|||
* @author Stephen Colebourne
|
||||
* @author Gary D. Gregory
|
||||
* @since 2.1
|
||||
* @version $Id: StrTokenizer.java,v 1.6 2004/12/25 21:02:20 bayard Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class StrTokenizer implements ListIterator, Cloneable {
|
||||
|
||||
|
@ -839,20 +839,20 @@ public class StrTokenizer implements ListIterator, Cloneable {
|
|||
|
||||
/* Trim string based on the trimmer matcher */
|
||||
while (trimmer.isMatch(chars, 1, start) > 0) {
|
||||
start++;
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
||||
int length = Math.min(pos, len) - start;
|
||||
int length = Math.min(pos, len) - start;
|
||||
|
||||
while (trimmer.isMatch(chars, 1, start + length - 1) > 0) {
|
||||
length--;
|
||||
}
|
||||
length--;
|
||||
}
|
||||
|
||||
for (int i=0;i<length;i++) {
|
||||
if (ignored.isMatch(chars, 1, start + i) == 0) {
|
||||
token.append(chars[start + i]);
|
||||
}
|
||||
}
|
||||
if (ignored.isMatch(chars, 1, start + i) == 0) {
|
||||
token.append(chars[start + i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return pos + delimLen;
|
||||
|
|
|
@ -26,7 +26,7 @@ import junit.textui.TestRunner;
|
|||
* @author Scott Sanders
|
||||
* @author Marc Johnson
|
||||
* @author Glen Stampoultzis
|
||||
* @version $Id: BitFieldTest.java,v 1.4 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class BitFieldTest extends TestCase {
|
||||
|
||||
|
@ -35,8 +35,8 @@ public class BitFieldTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(BitFieldTest.class);
|
||||
suite.setName("BitField Tests");
|
||||
TestSuite suite = new TestSuite(BitFieldTest.class);
|
||||
suite.setName("BitField Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author Stephen Colebourne
|
||||
* @author Matthew Hawthorne
|
||||
* @version $Id: BooleanUtilsTest.java,v 1.10 2004/10/08 21:27:00 scolebourne Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class BooleanUtilsTest extends TestCase {
|
||||
|
||||
|
@ -41,8 +41,8 @@ public class BooleanUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(BooleanUtilsTest.class);
|
||||
suite.setName("BooleanUtils Tests");
|
||||
TestSuite suite = new TestSuite(BooleanUtilsTest.class);
|
||||
suite.setName("BooleanUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import junit.textui.TestRunner;
|
|||
* Unit tests {@link org.apache.commons.lang.CharUtils}.
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
* @version $Id: CharUtilsTest.java,v 1.4 2004/03/10 23:23:46 scolebourne Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CharUtilsTest extends TestCase {
|
||||
|
||||
|
@ -44,8 +44,8 @@ public class CharUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(CharUtilsTest.class);
|
||||
suite.setName("CharUtils Tests");
|
||||
TestSuite suite = new TestSuite(CharUtilsTest.class);
|
||||
suite.setName("CharUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ public class ClassUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(ClassUtilsTest.class);
|
||||
suite.setName("ClassUtils Tests");
|
||||
TestSuite suite = new TestSuite(ClassUtilsTest.class);
|
||||
suite.setName("ClassUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
@ -390,12 +390,12 @@ public class ClassUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static ClassLoader newSystemClassLoader() throws SecurityException, IllegalArgumentException {
|
||||
ClassLoader scl = ClassLoader.getSystemClassLoader();
|
||||
if (!(scl instanceof URLClassLoader)) {
|
||||
fail("Need a better test set up.");
|
||||
}
|
||||
URLClassLoader urlScl = (URLClassLoader)scl;
|
||||
return URLClassLoader.newInstance(urlScl.getURLs(), null);
|
||||
ClassLoader scl = ClassLoader.getSystemClassLoader();
|
||||
if (!(scl instanceof URLClassLoader)) {
|
||||
fail("Need a better test set up.");
|
||||
}
|
||||
URLClassLoader urlScl = (URLClassLoader)scl;
|
||||
return URLClassLoader.newInstance(urlScl.getURLs(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import junit.framework.TestSuite;
|
|||
* @author <a href="mailto:chrise@esha.com">Christopher Elkins</a>
|
||||
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
|
||||
* @author Tim O'Brien
|
||||
* @version $Revision: 1.8 $ $Date: 2004/02/18 23:22:29 $
|
||||
* @version $Revision: 1.8 $ $Date$
|
||||
*/
|
||||
|
||||
public final class NumberRangeTest extends TestCase {
|
||||
|
@ -183,28 +183,28 @@ public final class NumberRangeTest extends TestCase {
|
|||
assertEquals("Unexpected max on NumberRange", 2.0, nr.getMaximum().doubleValue(), Double.MIN_VALUE);
|
||||
}
|
||||
|
||||
public void testConstructorNullParameters() {
|
||||
try {
|
||||
NumberRange nr = new NumberRange(null);
|
||||
fail("NumberRange(null) did not throw an exception.");
|
||||
} catch (Exception e) {
|
||||
assertTrue( "NumberRange(null)", e instanceof NullPointerException);
|
||||
}
|
||||
public void testConstructorNullParameters() {
|
||||
try {
|
||||
NumberRange nr = new NumberRange(null);
|
||||
fail("NumberRange(null) did not throw an exception.");
|
||||
} catch (Exception e) {
|
||||
assertTrue( "NumberRange(null)", e instanceof NullPointerException);
|
||||
}
|
||||
|
||||
try {
|
||||
NumberRange nr = new NumberRange(five, null);
|
||||
fail("NumberRange(five, null) did not throw an exception.");
|
||||
} catch (Exception e) {
|
||||
assertTrue("NumberRange(five, null)", e instanceof NullPointerException);
|
||||
}
|
||||
try {
|
||||
NumberRange nr = new NumberRange(five, null);
|
||||
fail("NumberRange(five, null) did not throw an exception.");
|
||||
} catch (Exception e) {
|
||||
assertTrue("NumberRange(five, null)", e instanceof NullPointerException);
|
||||
}
|
||||
|
||||
try {
|
||||
NumberRange nr = new NumberRange(null, five);
|
||||
fail("NumberRange(null, five) did not throw an exception.");
|
||||
} catch (Exception e) {
|
||||
assertTrue("NumberRange(null, five)", e instanceof NullPointerException);
|
||||
}
|
||||
}
|
||||
try {
|
||||
NumberRange nr = new NumberRange(null, five);
|
||||
fail("NumberRange(null, five) did not throw an exception.");
|
||||
} catch (Exception e) {
|
||||
assertTrue("NumberRange(null, five)", e instanceof NullPointerException);
|
||||
}
|
||||
}
|
||||
|
||||
public void testConstructorWithMaxLessThanMin() {
|
||||
NumberRange nr = new NumberRange( new Double(2.0), new Double(1.0));
|
||||
|
|
|
@ -29,7 +29,7 @@ import junit.textui.TestRunner;
|
|||
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
|
||||
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
|
||||
* @author Phil Steitz
|
||||
* @version $Id: RandomStringUtilsTest.java,v 1.13 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class RandomStringUtilsTest extends junit.framework.TestCase {
|
||||
/**
|
||||
|
@ -40,8 +40,8 @@ public class RandomStringUtilsTest extends junit.framework.TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(RandomStringUtilsTest.class);
|
||||
suite.setName("RandomStringUtils Tests");
|
||||
TestSuite suite = new TestSuite(RandomStringUtilsTest.class);
|
||||
suite.setName("RandomStringUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
|
||||
* @version $Id: SerializationUtilsTest.java,v 1.6 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SerializationUtilsTest extends TestCase {
|
||||
private String iString;
|
||||
|
@ -49,8 +49,8 @@ public class SerializationUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(SerializationUtilsTest.class);
|
||||
suite.setName("SerializationUtils Tests");
|
||||
TestSuite suite = new TestSuite(SerializationUtilsTest.class);
|
||||
suite.setName("SerializationUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import junit.textui.TestRunner;
|
|||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
|
||||
* @author Phil Steitz
|
||||
* @version $Id: StringUtilsEqualsIndexOfTest.java,v 1.10 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class StringUtilsEqualsIndexOfTest extends TestCase {
|
||||
private static final String FOO = "foo";
|
||||
|
@ -43,8 +43,8 @@ public class StringUtilsEqualsIndexOfTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StringUtilsEqualsIndexOfTest.class);
|
||||
suite.setName("StringUtilsEqualsIndexOf Tests");
|
||||
TestSuite suite = new TestSuite(StringUtilsEqualsIndexOfTest.class);
|
||||
suite.setName("StringUtilsEqualsIndexOf Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @author Michael Davey
|
||||
* @version $Id: StringUtilsIsTest.java,v 1.9 2004/02/24 22:31:43 fredrik Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class StringUtilsIsTest extends TestCase {
|
||||
|
||||
|
@ -38,8 +38,8 @@ public class StringUtilsIsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StringUtilsIsTest.class);
|
||||
suite.setName("StringUtilsIsXxx Tests");
|
||||
TestSuite suite = new TestSuite(StringUtilsIsTest.class);
|
||||
suite.setName("StringUtilsIsXxx Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import junit.textui.TestRunner;
|
|||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
|
||||
* @author Phil Steitz
|
||||
* @version $Id: StringUtilsSubstringTest.java,v 1.14 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class StringUtilsSubstringTest extends TestCase {
|
||||
private static final String FOO = "foo";
|
||||
|
@ -44,8 +44,8 @@ public class StringUtilsSubstringTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StringUtilsSubstringTest.class);
|
||||
suite.setName("StringUtilsSubstring Tests");
|
||||
TestSuite suite = new TestSuite(StringUtilsSubstringTest.class);
|
||||
suite.setName("StringUtilsSubstring Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ public class StringUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StringUtilsTest.class);
|
||||
suite.setName("StringUtilsTest Tests");
|
||||
TestSuite suite = new TestSuite(StringUtilsTest.class);
|
||||
suite.setName("StringUtilsTest Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
|
||||
* @version $Id: StringUtilsTrimEmptyTest.java,v 1.17 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class StringUtilsTrimEmptyTest extends TestCase {
|
||||
private static final String FOO = "foo";
|
||||
|
@ -39,8 +39,8 @@ public class StringUtilsTrimEmptyTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StringUtilsTrimEmptyTest.class);
|
||||
suite.setName("StringUtilsTrimEmpty Tests");
|
||||
TestSuite suite = new TestSuite(StringUtilsTrimEmptyTest.class);
|
||||
suite.setName("StringUtilsTrimEmpty Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author Stephen Colebourne
|
||||
* @author Norm Deane
|
||||
* @version $Id: ValidateTest.java,v 1.6 2004/10/08 21:44:41 scolebourne Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ValidateTest extends TestCase {
|
||||
|
||||
|
@ -43,8 +43,8 @@ public class ValidateTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(ValidateTest.class);
|
||||
suite.setName("Validate Tests");
|
||||
TestSuite suite = new TestSuite(ValidateTest.class);
|
||||
suite.setName("Validate Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
@ -359,23 +359,23 @@ public class ValidateTest extends TestCase {
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testAllElementsOfType() {
|
||||
List coll = new ArrayList();
|
||||
coll.add("a");
|
||||
coll.add("b");
|
||||
Validate.allElementsOfType(coll, String.class, "MSG");
|
||||
try {
|
||||
Validate.allElementsOfType(coll, Integer.class, "MSG");
|
||||
fail("Expecting IllegalArgumentException");
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("MSG", ex.getMessage());
|
||||
}
|
||||
coll.set(1, Boolean.FALSE);
|
||||
try {
|
||||
Validate.allElementsOfType(coll, String.class);
|
||||
fail("Expecting IllegalArgumentException");
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("The validated collection contains an element not of type java.lang.String at index: 1", ex.getMessage());
|
||||
}
|
||||
List coll = new ArrayList();
|
||||
coll.add("a");
|
||||
coll.add("b");
|
||||
Validate.allElementsOfType(coll, String.class, "MSG");
|
||||
try {
|
||||
Validate.allElementsOfType(coll, Integer.class, "MSG");
|
||||
fail("Expecting IllegalArgumentException");
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("MSG", ex.getMessage());
|
||||
}
|
||||
coll.set(1, Boolean.FALSE);
|
||||
try {
|
||||
Validate.allElementsOfType(coll, String.class);
|
||||
fail("Expecting IllegalArgumentException");
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("The validated collection contains an element not of type java.lang.String at index: 1", ex.getMessage());
|
||||
}
|
||||
|
||||
coll = new ArrayList();
|
||||
coll.add(new Integer(5));
|
||||
|
|
|
@ -27,7 +27,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author <a href="mailto:sdowney@panix.com">Steve Downey</a>
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Id: CompareToBuilderTest.java,v 1.8 2004/02/18 23:00:51 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CompareToBuilderTest extends TestCase {
|
||||
|
||||
|
@ -77,10 +77,10 @@ public class CompareToBuilderTest extends TestCase {
|
|||
public int getA() {
|
||||
return a;
|
||||
}
|
||||
public int compareTo(Object o) {
|
||||
TestObject rhs = (TestObject) o;
|
||||
return (a < rhs.a) ? -1 : (a > rhs.a) ? +1 : 0;
|
||||
}
|
||||
public int compareTo(Object o) {
|
||||
TestObject rhs = (TestObject) o;
|
||||
return (a < rhs.a) ? -1 : (a > rhs.a) ? +1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static class TestSubObject extends TestObject {
|
||||
|
|
|
@ -30,7 +30,7 @@ import junit.textui.TestRunner;
|
|||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
||||
* @author <a href="mailto:alex@apache.org">Alex Chaffee</a>
|
||||
* @version $Id: ToStringBuilderTest.java,v 1.16 2004/07/26 21:39:21 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ToStringBuilderTest extends TestCase {
|
||||
|
||||
|
@ -355,15 +355,15 @@ public class ToStringBuilderTest extends TestCase {
|
|||
this.validateEmptyReflectionRegistry();
|
||||
}
|
||||
|
||||
static class ReflectionTestFixtureA {
|
||||
private char a='a';
|
||||
static class ReflectionTestFixtureA {
|
||||
private char a='a';
|
||||
private transient char transientA='t';
|
||||
}
|
||||
}
|
||||
|
||||
static class ReflectionTestFixtureB extends ReflectionTestFixtureA {
|
||||
private char b='b';
|
||||
static class ReflectionTestFixtureB extends ReflectionTestFixtureA {
|
||||
private char b='b';
|
||||
private transient char transientB='t';
|
||||
}
|
||||
}
|
||||
|
||||
public void testInnerClassReflection() {
|
||||
Outer outer = new Outer();
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.commons.lang.SerializationUtils;
|
|||
*
|
||||
* @author Stephen Colebourne
|
||||
* @author Gary D. Gregory
|
||||
* @version $Id: EnumTest.java,v 1.17 2004/02/18 23:01:51 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
public final class EnumTest extends TestCase {
|
||||
|
@ -105,7 +105,7 @@ public final class EnumTest extends TestCase {
|
|||
assertNotNull(list);
|
||||
|
||||
assertEquals( list.size(),
|
||||
ColorEnum.getEnumMap().keySet().size());
|
||||
ColorEnum.getEnumMap().keySet().size());
|
||||
|
||||
Iterator it = list.iterator();
|
||||
assertSame(ColorEnum.RED, it.next());
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.commons.lang.SerializationUtils;
|
|||
* Test cases for the {@link Enum} class.
|
||||
*
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Id: ValuedEnumTest.java,v 1.7 2004/02/18 23:22:29 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
public final class ValuedEnumTest extends TestCase {
|
||||
|
@ -88,7 +88,7 @@ public final class ValuedEnumTest extends TestCase {
|
|||
assertNotNull(list);
|
||||
|
||||
assertEquals( list.size(),
|
||||
ValuedColorEnum.getEnumMap().keySet().size());
|
||||
ValuedColorEnum.getEnumMap().keySet().size());
|
||||
|
||||
Iterator it = list.iterator();
|
||||
assertSame(ValuedColorEnum.RED, it.next());
|
||||
|
@ -102,8 +102,8 @@ public final class ValuedEnumTest extends TestCase {
|
|||
assertNotNull(map);
|
||||
|
||||
assertEquals( map.keySet().size(),
|
||||
ValuedColorEnum.getEnumList().size());
|
||||
|
||||
ValuedColorEnum.getEnumList().size());
|
||||
|
||||
assertTrue(map.containsValue(ValuedColorEnum.RED));
|
||||
assertTrue(map.containsValue(ValuedColorEnum.GREEN));
|
||||
assertTrue(map.containsValue(ValuedColorEnum.BLUE));
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.commons.lang.SerializationUtils;
|
|||
*
|
||||
* @author Stephen Colebourne
|
||||
* @author Gary D. Gregory
|
||||
* @version $Id: EnumTest.java,v 1.1 2004/02/23 04:34:20 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
public final class EnumTest extends TestCase {
|
||||
|
@ -105,7 +105,7 @@ public final class EnumTest extends TestCase {
|
|||
assertNotNull(list);
|
||||
|
||||
assertEquals( list.size(),
|
||||
ColorEnum.getEnumMap().keySet().size());
|
||||
ColorEnum.getEnumMap().keySet().size());
|
||||
|
||||
Iterator it = list.iterator();
|
||||
assertSame(ColorEnum.RED, it.next());
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.commons.lang.SerializationUtils;
|
|||
* Test cases for the {@link Enum} class.
|
||||
*
|
||||
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
|
||||
* @version $Id: ValuedEnumTest.java,v 1.1 2004/02/23 04:34:20 ggregory Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
public final class ValuedEnumTest extends TestCase {
|
||||
|
@ -88,7 +88,7 @@ public final class ValuedEnumTest extends TestCase {
|
|||
assertNotNull(list);
|
||||
|
||||
assertEquals( list.size(),
|
||||
ValuedColorEnum.getEnumMap().keySet().size());
|
||||
ValuedColorEnum.getEnumMap().keySet().size());
|
||||
|
||||
Iterator it = list.iterator();
|
||||
assertSame(ValuedColorEnum.RED, it.next());
|
||||
|
@ -102,8 +102,8 @@ public final class ValuedEnumTest extends TestCase {
|
|||
assertNotNull(map);
|
||||
|
||||
assertEquals( map.keySet().size(),
|
||||
ValuedColorEnum.getEnumList().size());
|
||||
|
||||
ValuedColorEnum.getEnumList().size());
|
||||
|
||||
assertTrue(map.containsValue(ValuedColorEnum.RED));
|
||||
assertTrue(map.containsValue(ValuedColorEnum.GREEN));
|
||||
assertTrue(map.containsValue(ValuedColorEnum.BLUE));
|
||||
|
|
|
@ -30,7 +30,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
|
||||
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
|
||||
* @version $Id: NestableDelegateTestCase.java,v 1.10 2004/12/25 19:50:09 bayard Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class NestableDelegateTestCase extends junit.framework.TestCase {
|
||||
private static final String CONSTRUCTOR_FAILED_MSG =
|
||||
|
@ -521,7 +521,7 @@ public class NestableDelegateTestCase extends junit.framework.TestCase {
|
|||
|
||||
// Only testing the flags for jdk1.3 and below
|
||||
if (!ExceptionUtils.isThrowableNested()) {
|
||||
NestableDelegate.topDown = true; NestableDelegate.trimStackFrames = true;
|
||||
NestableDelegate.topDown = true; NestableDelegate.trimStackFrames = true;
|
||||
checkStackTrace(d, true, true, NestableDelegateTester1.class.getName()+": level 1", 24);
|
||||
NestableDelegate.topDown = true; NestableDelegate.trimStackFrames = false;
|
||||
checkStackTrace(d, true, false, NestableDelegateTester1.class.getName()+": level 1", 80);
|
||||
|
|
|
@ -30,7 +30,7 @@ import junit.textui.TestRunner;
|
|||
* Tests the org.apache.commons.lang.exception.NestableException class.
|
||||
*
|
||||
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
|
||||
* @version $Id: NestableExceptionTestCase.java,v 1.12 2004/10/09 10:45:24 scolebourne Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class NestableExceptionTestCase extends AbstractNestableTestCase {
|
||||
|
||||
|
@ -252,61 +252,61 @@ public class NestableExceptionTestCase extends AbstractNestableTestCase {
|
|||
}
|
||||
|
||||
public void testSerialization()
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
RuntimeException nestedEx = new RuntimeException("nested exception message");
|
||||
NestableExceptionTester1 ex = new NestableExceptionTester1("serialization test", nestedEx);
|
||||
RuntimeException nestedEx = new RuntimeException("nested exception message");
|
||||
NestableExceptionTester1 ex = new NestableExceptionTester1("serialization test", nestedEx);
|
||||
|
||||
assertTrue( "implements java.io.Serializable", nestedEx instanceof java.io.Serializable);
|
||||
|
||||
assertTrue( "implements java.io.Serializable", ex instanceof java.io.Serializable);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream bais = null;
|
||||
ObjectOutputStream oos = null;
|
||||
ObjectInputStream ois = null;
|
||||
assertTrue( "implements java.io.Serializable", nestedEx instanceof java.io.Serializable);
|
||||
|
||||
assertTrue( "implements java.io.Serializable", ex instanceof java.io.Serializable);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream bais = null;
|
||||
ObjectOutputStream oos = null;
|
||||
ObjectInputStream ois = null;
|
||||
|
||||
try
|
||||
{
|
||||
oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(ex);
|
||||
oos.flush();
|
||||
bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
ois = new ObjectInputStream(bais);
|
||||
NestableExceptionTester1 deserializedEx = (NestableExceptionTester1) ois.readObject();
|
||||
assertEquals(
|
||||
"getThrowableCount() return value",
|
||||
ex.getThrowableCount(),
|
||||
deserializedEx.getThrowableCount());
|
||||
|
||||
for (int i = 0; i < ex.getThrowableCount(); i++)
|
||||
{
|
||||
Throwable t = ex.getThrowable(i);
|
||||
Throwable deserializedThrowable = deserializedEx.getThrowable(i);
|
||||
|
||||
assertEquals( t.getClass(),
|
||||
deserializedThrowable.getClass());
|
||||
|
||||
assertEquals(
|
||||
t.getMessage(),
|
||||
deserializedThrowable.getMessage());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != oos)
|
||||
{
|
||||
try
|
||||
{
|
||||
oos.close();
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
// intentionally empty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(ex);
|
||||
oos.flush();
|
||||
bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
ois = new ObjectInputStream(bais);
|
||||
NestableExceptionTester1 deserializedEx = (NestableExceptionTester1) ois.readObject();
|
||||
assertEquals(
|
||||
"getThrowableCount() return value",
|
||||
ex.getThrowableCount(),
|
||||
deserializedEx.getThrowableCount());
|
||||
|
||||
for (int i = 0; i < ex.getThrowableCount(); i++)
|
||||
{
|
||||
Throwable t = ex.getThrowable(i);
|
||||
Throwable deserializedThrowable = deserializedEx.getThrowable(i);
|
||||
|
||||
assertEquals( t.getClass(),
|
||||
deserializedThrowable.getClass());
|
||||
|
||||
assertEquals(
|
||||
t.getMessage(),
|
||||
deserializedThrowable.getMessage());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != oos)
|
||||
{
|
||||
try
|
||||
{
|
||||
oos.close();
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
// intentionally empty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.HashMap;
|
|||
*
|
||||
* @author Henri Yandell
|
||||
* @author Ken Fitzpatrick
|
||||
* @version $Id: InterpolationTest.java,v 1.1 2004/09/05 00:56:31 bayard Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class InterpolationTest extends TestCase {
|
||||
|
||||
|
@ -45,8 +45,8 @@ public class InterpolationTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(InterpolationTest.class);
|
||||
suite.setName("Interpolation Tests");
|
||||
TestSuite suite = new TestSuite(InterpolationTest.class);
|
||||
suite.setName("Interpolation Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ public class DateFormatUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(DateFormatUtilsTest.class);
|
||||
suite.setName("DateFormatUtils Tests");
|
||||
TestSuite suite = new TestSuite(DateFormatUtilsTest.class);
|
||||
suite.setName("DateFormatUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ public class DateUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(DateUtilsTest.class);
|
||||
suite.setName("DateUtils Tests");
|
||||
TestSuite suite = new TestSuite(DateUtilsTest.class);
|
||||
suite.setName("DateUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ public class DurationFormatUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(DurationFormatUtilsTest.class);
|
||||
suite.setName("DurationFormatUtils Tests");
|
||||
TestSuite suite = new TestSuite(DurationFormatUtilsTest.class);
|
||||
suite.setName("DurationFormatUtils Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ public class StopWatchTest extends TestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StopWatchTest.class);
|
||||
suite.setName("StopWatch Tests");
|
||||
TestSuite suite = new TestSuite(StopWatchTest.class);
|
||||
suite.setName("StopWatch Tests");
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue