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:
Henri Yandell 2005-02-04 02:37:55 +00:00
parent bb99d6906b
commit 413cd09a61
29 changed files with 192 additions and 192 deletions

View File

@ -170,7 +170,7 @@ public class ClassUtils {
* <p>Gets the package name from a <code>String</code>.</p> * <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>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> * @param className the className to get the package name for, may be <code>null</code>
* @return the package name or an empty string * @return the package name or an empty string

View File

@ -35,7 +35,7 @@ import java.util.Map;
* @author Gary Gregory * @author Gary Gregory
* @author Norm Deane * @author Norm Deane
* @since 2.0 * @since 2.0
* @version $Id: Validate.java,v 1.13 2004/10/08 21:44:41 scolebourne Exp $ * @version $Id$
*/ */
public class Validate { public class Validate {
// Validate has no dependencies on other classes in Commons Lang at present // Validate has no dependencies on other classes in Commons Lang at present
@ -508,13 +508,13 @@ public class Validate {
* @since 2.1 * @since 2.1
*/ */
public static void allElementsOfType(Collection collection, Class clazz, String message) { public static void allElementsOfType(Collection collection, Class clazz, String message) {
Validate.notNull(collection); Validate.notNull(collection);
Validate.notNull(clazz); Validate.notNull(clazz);
for (Iterator it = collection.iterator(); it.hasNext(); ) { for (Iterator it = collection.iterator(); it.hasNext(); ) {
if (clazz.isInstance(it.next()) == false) { if (clazz.isInstance(it.next()) == false) {
throw new IllegalArgumentException(message); throw new IllegalArgumentException(message);
} }
} }
} }
/** /**
@ -533,15 +533,15 @@ public class Validate {
* @since 2.1 * @since 2.1
*/ */
public static void allElementsOfType(Collection collection, Class clazz) { public static void allElementsOfType(Collection collection, Class clazz) {
Validate.notNull(collection); Validate.notNull(collection);
Validate.notNull(clazz); Validate.notNull(clazz);
int i = 0; int i = 0;
for (Iterator it = collection.iterator(); it.hasNext(); i++) { for (Iterator it = collection.iterator(); it.hasNext(); i++) {
if (clazz.isInstance(it.next()) == false) { 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); + clazz.getName() + " at index: " + i);
} }
} }
} }
} }

View File

@ -73,7 +73,7 @@ import java.util.ListIterator;
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Gary D. Gregory * @author Gary D. Gregory
* @since 2.1 * @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 { public class StrTokenizer implements ListIterator, Cloneable {
@ -839,20 +839,20 @@ public class StrTokenizer implements ListIterator, Cloneable {
/* Trim string based on the trimmer matcher */ /* Trim string based on the trimmer matcher */
while (trimmer.isMatch(chars, 1, start) > 0) { 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) { while (trimmer.isMatch(chars, 1, start + length - 1) > 0) {
length--; length--;
} }
for (int i=0;i<length;i++) { for (int i=0;i<length;i++) {
if (ignored.isMatch(chars, 1, start + i) == 0) { if (ignored.isMatch(chars, 1, start + i) == 0) {
token.append(chars[start + i]); token.append(chars[start + i]);
} }
} }
return pos + delimLen; return pos + delimLen;

View File

@ -26,7 +26,7 @@ import junit.textui.TestRunner;
* @author Scott Sanders * @author Scott Sanders
* @author Marc Johnson * @author Marc Johnson
* @author Glen Stampoultzis * @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 { public class BitFieldTest extends TestCase {
@ -35,8 +35,8 @@ public class BitFieldTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(BitFieldTest.class); TestSuite suite = new TestSuite(BitFieldTest.class);
suite.setName("BitField Tests"); suite.setName("BitField Tests");
return suite; return suite;
} }

View File

@ -28,7 +28,7 @@ import junit.textui.TestRunner;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Matthew Hawthorne * @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 { public class BooleanUtilsTest extends TestCase {
@ -41,8 +41,8 @@ public class BooleanUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(BooleanUtilsTest.class); TestSuite suite = new TestSuite(BooleanUtilsTest.class);
suite.setName("BooleanUtils Tests"); suite.setName("BooleanUtils Tests");
return suite; return suite;
} }

View File

@ -27,7 +27,7 @@ import junit.textui.TestRunner;
* Unit tests {@link org.apache.commons.lang.CharUtils}. * Unit tests {@link org.apache.commons.lang.CharUtils}.
* *
* @author Stephen Colebourne * @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 { public class CharUtilsTest extends TestCase {
@ -44,8 +44,8 @@ public class CharUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(CharUtilsTest.class); TestSuite suite = new TestSuite(CharUtilsTest.class);
suite.setName("CharUtils Tests"); suite.setName("CharUtils Tests");
return suite; return suite;
} }

View File

@ -45,8 +45,8 @@ public class ClassUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(ClassUtilsTest.class); TestSuite suite = new TestSuite(ClassUtilsTest.class);
suite.setName("ClassUtils Tests"); suite.setName("ClassUtils Tests");
return suite; return suite;
} }
@ -390,12 +390,12 @@ public class ClassUtilsTest extends TestCase {
} }
public static ClassLoader newSystemClassLoader() throws SecurityException, IllegalArgumentException { public static ClassLoader newSystemClassLoader() throws SecurityException, IllegalArgumentException {
ClassLoader scl = ClassLoader.getSystemClassLoader(); ClassLoader scl = ClassLoader.getSystemClassLoader();
if (!(scl instanceof URLClassLoader)) { if (!(scl instanceof URLClassLoader)) {
fail("Need a better test set up."); fail("Need a better test set up.");
} }
URLClassLoader urlScl = (URLClassLoader)scl; URLClassLoader urlScl = (URLClassLoader)scl;
return URLClassLoader.newInstance(urlScl.getURLs(), null); return URLClassLoader.newInstance(urlScl.getURLs(), null);
} }
} }

View File

@ -25,7 +25,7 @@ import junit.framework.TestSuite;
* @author <a href="mailto:chrise@esha.com">Christopher Elkins</a> * @author <a href="mailto:chrise@esha.com">Christopher Elkins</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a> * @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
* @author Tim O'Brien * @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 { 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); assertEquals("Unexpected max on NumberRange", 2.0, nr.getMaximum().doubleValue(), Double.MIN_VALUE);
} }
public void testConstructorNullParameters() { public void testConstructorNullParameters() {
try { try {
NumberRange nr = new NumberRange(null); NumberRange nr = new NumberRange(null);
fail("NumberRange(null) did not throw an exception."); fail("NumberRange(null) did not throw an exception.");
} catch (Exception e) { } catch (Exception e) {
assertTrue( "NumberRange(null)", e instanceof NullPointerException); assertTrue( "NumberRange(null)", e instanceof NullPointerException);
} }
try { try {
NumberRange nr = new NumberRange(five, null); NumberRange nr = new NumberRange(five, null);
fail("NumberRange(five, null) did not throw an exception."); fail("NumberRange(five, null) did not throw an exception.");
} catch (Exception e) { } catch (Exception e) {
assertTrue("NumberRange(five, null)", e instanceof NullPointerException); assertTrue("NumberRange(five, null)", e instanceof NullPointerException);
} }
try { try {
NumberRange nr = new NumberRange(null, five); NumberRange nr = new NumberRange(null, five);
fail("NumberRange(null, five) did not throw an exception."); fail("NumberRange(null, five) did not throw an exception.");
} catch (Exception e) { } catch (Exception e) {
assertTrue("NumberRange(null, five)", e instanceof NullPointerException); assertTrue("NumberRange(null, five)", e instanceof NullPointerException);
} }
} }
public void testConstructorWithMaxLessThanMin() { public void testConstructorWithMaxLessThanMin() {
NumberRange nr = new NumberRange( new Double(2.0), new Double(1.0)); NumberRange nr = new NumberRange( new Double(2.0), new Double(1.0));

View File

@ -29,7 +29,7 @@ import junit.textui.TestRunner;
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a> * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a> * @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
* @author Phil Steitz * @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 { public class RandomStringUtilsTest extends junit.framework.TestCase {
/** /**
@ -40,8 +40,8 @@ public class RandomStringUtilsTest extends junit.framework.TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(RandomStringUtilsTest.class); TestSuite suite = new TestSuite(RandomStringUtilsTest.class);
suite.setName("RandomStringUtils Tests"); suite.setName("RandomStringUtils Tests");
return suite; return suite;
} }

View File

@ -33,7 +33,7 @@ import junit.textui.TestRunner;
* *
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</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 { public class SerializationUtilsTest extends TestCase {
private String iString; private String iString;
@ -49,8 +49,8 @@ public class SerializationUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(SerializationUtilsTest.class); TestSuite suite = new TestSuite(SerializationUtilsTest.class);
suite.setName("SerializationUtils Tests"); suite.setName("SerializationUtils Tests");
return suite; return suite;
} }

View File

@ -26,7 +26,7 @@ import junit.textui.TestRunner;
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a> * @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
* @author Phil Steitz * @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 { public class StringUtilsEqualsIndexOfTest extends TestCase {
private static final String FOO = "foo"; private static final String FOO = "foo";
@ -43,8 +43,8 @@ public class StringUtilsEqualsIndexOfTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(StringUtilsEqualsIndexOfTest.class); TestSuite suite = new TestSuite(StringUtilsEqualsIndexOfTest.class);
suite.setName("StringUtilsEqualsIndexOf Tests"); suite.setName("StringUtilsEqualsIndexOf Tests");
return suite; return suite;
} }

View File

@ -25,7 +25,7 @@ import junit.textui.TestRunner;
* *
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author Michael Davey * @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 { public class StringUtilsIsTest extends TestCase {
@ -38,8 +38,8 @@ public class StringUtilsIsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(StringUtilsIsTest.class); TestSuite suite = new TestSuite(StringUtilsIsTest.class);
suite.setName("StringUtilsIsXxx Tests"); suite.setName("StringUtilsIsXxx Tests");
return suite; return suite;
} }

View File

@ -26,7 +26,7 @@ import junit.textui.TestRunner;
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a> * @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
* @author Phil Steitz * @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 { public class StringUtilsSubstringTest extends TestCase {
private static final String FOO = "foo"; private static final String FOO = "foo";
@ -44,8 +44,8 @@ public class StringUtilsSubstringTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(StringUtilsSubstringTest.class); TestSuite suite = new TestSuite(StringUtilsSubstringTest.class);
suite.setName("StringUtilsSubstring Tests"); suite.setName("StringUtilsSubstring Tests");
return suite; return suite;
} }

View File

@ -98,8 +98,8 @@ public class StringUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(StringUtilsTest.class); TestSuite suite = new TestSuite(StringUtilsTest.class);
suite.setName("StringUtilsTest Tests"); suite.setName("StringUtilsTest Tests");
return suite; return suite;
} }

View File

@ -25,7 +25,7 @@ import junit.textui.TestRunner;
* *
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</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 { public class StringUtilsTrimEmptyTest extends TestCase {
private static final String FOO = "foo"; private static final String FOO = "foo";
@ -39,8 +39,8 @@ public class StringUtilsTrimEmptyTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(StringUtilsTrimEmptyTest.class); TestSuite suite = new TestSuite(StringUtilsTrimEmptyTest.class);
suite.setName("StringUtilsTrimEmpty Tests"); suite.setName("StringUtilsTrimEmpty Tests");
return suite; return suite;
} }

View File

@ -30,7 +30,7 @@ import junit.textui.TestRunner;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Norm Deane * @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 { public class ValidateTest extends TestCase {
@ -43,8 +43,8 @@ public class ValidateTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(ValidateTest.class); TestSuite suite = new TestSuite(ValidateTest.class);
suite.setName("Validate Tests"); suite.setName("Validate Tests");
return suite; return suite;
} }
@ -359,23 +359,23 @@ public class ValidateTest extends TestCase {
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
public void testAllElementsOfType() { public void testAllElementsOfType() {
List coll = new ArrayList(); List coll = new ArrayList();
coll.add("a"); coll.add("a");
coll.add("b"); coll.add("b");
Validate.allElementsOfType(coll, String.class, "MSG"); Validate.allElementsOfType(coll, String.class, "MSG");
try { try {
Validate.allElementsOfType(coll, Integer.class, "MSG"); Validate.allElementsOfType(coll, Integer.class, "MSG");
fail("Expecting IllegalArgumentException"); fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
assertEquals("MSG", ex.getMessage()); assertEquals("MSG", ex.getMessage());
} }
coll.set(1, Boolean.FALSE); coll.set(1, Boolean.FALSE);
try { try {
Validate.allElementsOfType(coll, String.class); Validate.allElementsOfType(coll, String.class);
fail("Expecting IllegalArgumentException"); fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
assertEquals("The validated collection contains an element not of type java.lang.String at index: 1", ex.getMessage()); assertEquals("The validated collection contains an element not of type java.lang.String at index: 1", ex.getMessage());
} }
coll = new ArrayList(); coll = new ArrayList();
coll.add(new Integer(5)); coll.add(new Integer(5));

View File

@ -27,7 +27,7 @@ import junit.textui.TestRunner;
* *
* @author <a href="mailto:sdowney@panix.com">Steve Downey</a> * @author <a href="mailto:sdowney@panix.com">Steve Downey</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</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 { public class CompareToBuilderTest extends TestCase {
@ -77,10 +77,10 @@ public class CompareToBuilderTest extends TestCase {
public int getA() { public int getA() {
return a; return a;
} }
public int compareTo(Object o) { public int compareTo(Object o) {
TestObject rhs = (TestObject) o; TestObject rhs = (TestObject) o;
return (a < rhs.a) ? -1 : (a > rhs.a) ? +1 : 0; return (a < rhs.a) ? -1 : (a > rhs.a) ? +1 : 0;
} }
} }
static class TestSubObject extends TestObject { static class TestSubObject extends TestObject {

View File

@ -30,7 +30,7 @@ import junit.textui.TestRunner;
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a> * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author <a href="mailto:alex@apache.org">Alex Chaffee</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 { public class ToStringBuilderTest extends TestCase {
@ -355,15 +355,15 @@ public class ToStringBuilderTest extends TestCase {
this.validateEmptyReflectionRegistry(); this.validateEmptyReflectionRegistry();
} }
static class ReflectionTestFixtureA { static class ReflectionTestFixtureA {
private char a='a'; private char a='a';
private transient char transientA='t'; private transient char transientA='t';
} }
static class ReflectionTestFixtureB extends ReflectionTestFixtureA { static class ReflectionTestFixtureB extends ReflectionTestFixtureA {
private char b='b'; private char b='b';
private transient char transientB='t'; private transient char transientB='t';
} }
public void testInnerClassReflection() { public void testInnerClassReflection() {
Outer outer = new Outer(); Outer outer = new Outer();

View File

@ -35,7 +35,7 @@ import org.apache.commons.lang.SerializationUtils;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Gary D. Gregory * @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 { public final class EnumTest extends TestCase {
@ -105,7 +105,7 @@ public final class EnumTest extends TestCase {
assertNotNull(list); assertNotNull(list);
assertEquals( list.size(), assertEquals( list.size(),
ColorEnum.getEnumMap().keySet().size()); ColorEnum.getEnumMap().keySet().size());
Iterator it = list.iterator(); Iterator it = list.iterator();
assertSame(ColorEnum.RED, it.next()); assertSame(ColorEnum.RED, it.next());

View File

@ -28,7 +28,7 @@ import org.apache.commons.lang.SerializationUtils;
* Test cases for the {@link Enum} class. * Test cases for the {@link Enum} class.
* *
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @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 { public final class ValuedEnumTest extends TestCase {
@ -88,7 +88,7 @@ public final class ValuedEnumTest extends TestCase {
assertNotNull(list); assertNotNull(list);
assertEquals( list.size(), assertEquals( list.size(),
ValuedColorEnum.getEnumMap().keySet().size()); ValuedColorEnum.getEnumMap().keySet().size());
Iterator it = list.iterator(); Iterator it = list.iterator();
assertSame(ValuedColorEnum.RED, it.next()); assertSame(ValuedColorEnum.RED, it.next());
@ -102,8 +102,8 @@ public final class ValuedEnumTest extends TestCase {
assertNotNull(map); assertNotNull(map);
assertEquals( map.keySet().size(), assertEquals( map.keySet().size(),
ValuedColorEnum.getEnumList().size()); ValuedColorEnum.getEnumList().size());
assertTrue(map.containsValue(ValuedColorEnum.RED)); assertTrue(map.containsValue(ValuedColorEnum.RED));
assertTrue(map.containsValue(ValuedColorEnum.GREEN)); assertTrue(map.containsValue(ValuedColorEnum.GREEN));
assertTrue(map.containsValue(ValuedColorEnum.BLUE)); assertTrue(map.containsValue(ValuedColorEnum.BLUE));

View File

@ -35,7 +35,7 @@ import org.apache.commons.lang.SerializationUtils;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Gary D. Gregory * @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 { public final class EnumTest extends TestCase {
@ -105,7 +105,7 @@ public final class EnumTest extends TestCase {
assertNotNull(list); assertNotNull(list);
assertEquals( list.size(), assertEquals( list.size(),
ColorEnum.getEnumMap().keySet().size()); ColorEnum.getEnumMap().keySet().size());
Iterator it = list.iterator(); Iterator it = list.iterator();
assertSame(ColorEnum.RED, it.next()); assertSame(ColorEnum.RED, it.next());

View File

@ -28,7 +28,7 @@ import org.apache.commons.lang.SerializationUtils;
* Test cases for the {@link Enum} class. * Test cases for the {@link Enum} class.
* *
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @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 { public final class ValuedEnumTest extends TestCase {
@ -88,7 +88,7 @@ public final class ValuedEnumTest extends TestCase {
assertNotNull(list); assertNotNull(list);
assertEquals( list.size(), assertEquals( list.size(),
ValuedColorEnum.getEnumMap().keySet().size()); ValuedColorEnum.getEnumMap().keySet().size());
Iterator it = list.iterator(); Iterator it = list.iterator();
assertSame(ValuedColorEnum.RED, it.next()); assertSame(ValuedColorEnum.RED, it.next());
@ -102,8 +102,8 @@ public final class ValuedEnumTest extends TestCase {
assertNotNull(map); assertNotNull(map);
assertEquals( map.keySet().size(), assertEquals( map.keySet().size(),
ValuedColorEnum.getEnumList().size()); ValuedColorEnum.getEnumList().size());
assertTrue(map.containsValue(ValuedColorEnum.RED)); assertTrue(map.containsValue(ValuedColorEnum.RED));
assertTrue(map.containsValue(ValuedColorEnum.GREEN)); assertTrue(map.containsValue(ValuedColorEnum.GREEN));
assertTrue(map.containsValue(ValuedColorEnum.BLUE)); assertTrue(map.containsValue(ValuedColorEnum.BLUE));

View File

@ -30,7 +30,7 @@ import junit.textui.TestRunner;
* *
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a> * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</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 { public class NestableDelegateTestCase extends junit.framework.TestCase {
private static final String CONSTRUCTOR_FAILED_MSG = 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 // Only testing the flags for jdk1.3 and below
if (!ExceptionUtils.isThrowableNested()) { 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); checkStackTrace(d, true, true, NestableDelegateTester1.class.getName()+": level 1", 24);
NestableDelegate.topDown = true; NestableDelegate.trimStackFrames = false; NestableDelegate.topDown = true; NestableDelegate.trimStackFrames = false;
checkStackTrace(d, true, false, NestableDelegateTester1.class.getName()+": level 1", 80); checkStackTrace(d, true, false, NestableDelegateTester1.class.getName()+": level 1", 80);

View File

@ -30,7 +30,7 @@ import junit.textui.TestRunner;
* Tests the org.apache.commons.lang.exception.NestableException class. * Tests the org.apache.commons.lang.exception.NestableException class.
* *
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a> * @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 { public class NestableExceptionTestCase extends AbstractNestableTestCase {
@ -252,61 +252,61 @@ public class NestableExceptionTestCase extends AbstractNestableTestCase {
} }
public void testSerialization() public void testSerialization()
throws java.io.IOException, ClassNotFoundException throws java.io.IOException, ClassNotFoundException
{ {
RuntimeException nestedEx = new RuntimeException("nested exception message"); RuntimeException nestedEx = new RuntimeException("nested exception message");
NestableExceptionTester1 ex = new NestableExceptionTester1("serialization test", nestedEx); NestableExceptionTester1 ex = new NestableExceptionTester1("serialization test", nestedEx);
assertTrue( "implements java.io.Serializable", nestedEx instanceof java.io.Serializable); assertTrue( "implements java.io.Serializable", nestedEx instanceof java.io.Serializable);
assertTrue( "implements java.io.Serializable", ex instanceof java.io.Serializable); assertTrue( "implements java.io.Serializable", ex instanceof java.io.Serializable);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
ByteArrayInputStream bais = null; ByteArrayInputStream bais = null;
ObjectOutputStream oos = null; ObjectOutputStream oos = null;
ObjectInputStream ois = null; ObjectInputStream ois = null;
try try
{ {
oos = new ObjectOutputStream(baos); oos = new ObjectOutputStream(baos);
oos.writeObject(ex); oos.writeObject(ex);
oos.flush(); oos.flush();
bais = new ByteArrayInputStream(baos.toByteArray()); bais = new ByteArrayInputStream(baos.toByteArray());
ois = new ObjectInputStream(bais); ois = new ObjectInputStream(bais);
NestableExceptionTester1 deserializedEx = (NestableExceptionTester1) ois.readObject(); NestableExceptionTester1 deserializedEx = (NestableExceptionTester1) ois.readObject();
assertEquals( assertEquals(
"getThrowableCount() return value", "getThrowableCount() return value",
ex.getThrowableCount(), ex.getThrowableCount(),
deserializedEx.getThrowableCount()); deserializedEx.getThrowableCount());
for (int i = 0; i < ex.getThrowableCount(); i++) for (int i = 0; i < ex.getThrowableCount(); i++)
{ {
Throwable t = ex.getThrowable(i); Throwable t = ex.getThrowable(i);
Throwable deserializedThrowable = deserializedEx.getThrowable(i); Throwable deserializedThrowable = deserializedEx.getThrowable(i);
assertEquals( t.getClass(), assertEquals( t.getClass(),
deserializedThrowable.getClass()); deserializedThrowable.getClass());
assertEquals( assertEquals(
t.getMessage(), t.getMessage(),
deserializedThrowable.getMessage()); deserializedThrowable.getMessage());
} }
} }
finally finally
{ {
if (null != oos) if (null != oos)
{ {
try try
{ {
oos.close(); oos.close();
} }
catch (Exception ignored) catch (Exception ignored)
{ {
// intentionally empty // intentionally empty
} }
} }
} }
} }
} }

View File

@ -28,7 +28,7 @@ import java.util.HashMap;
* *
* @author Henri Yandell * @author Henri Yandell
* @author Ken Fitzpatrick * @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 { public class InterpolationTest extends TestCase {
@ -45,8 +45,8 @@ public class InterpolationTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(InterpolationTest.class); TestSuite suite = new TestSuite(InterpolationTest.class);
suite.setName("Interpolation Tests"); suite.setName("Interpolation Tests");
return suite; return suite;
} }

View File

@ -41,8 +41,8 @@ public class DateFormatUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(DateFormatUtilsTest.class); TestSuite suite = new TestSuite(DateFormatUtilsTest.class);
suite.setName("DateFormatUtils Tests"); suite.setName("DateFormatUtils Tests");
return suite; return suite;
} }

View File

@ -81,8 +81,8 @@ public class DateUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(DateUtilsTest.class); TestSuite suite = new TestSuite(DateUtilsTest.class);
suite.setName("DateUtils Tests"); suite.setName("DateUtils Tests");
return suite; return suite;
} }

View File

@ -42,8 +42,8 @@ public class DurationFormatUtilsTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(DurationFormatUtilsTest.class); TestSuite suite = new TestSuite(DurationFormatUtilsTest.class);
suite.setName("DurationFormatUtils Tests"); suite.setName("DurationFormatUtils Tests");
return suite; return suite;
} }

View File

@ -33,8 +33,8 @@ public class StopWatchTest extends TestCase {
} }
public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite(StopWatchTest.class); TestSuite suite = new TestSuite(StopWatchTest.class);
suite.setName("StopWatch Tests"); suite.setName("StopWatch Tests");
return suite; return suite;
} }