added test code for Map keySet size and List size

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137097 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sean Sullivan 2002-10-13 18:42:06 +00:00
parent b759cf0bc6
commit 1ad5019544
2 changed files with 26 additions and 2 deletions

View File

@ -66,7 +66,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: EnumTest.java,v 1.1 2002/08/11 23:17:54 scolebourne Exp $
* @version $Id: EnumTest.java,v 1.2 2002/10/13 18:41:24 sullis Exp $
*/
public final class EnumTest extends TestCase {
@ -114,6 +114,12 @@ public final class EnumTest extends TestCase {
public void testList() {
List list = ColorEnum.getEnumList();
assertNotNull(list);
assertEquals( list.size(),
ColorEnum.getEnumMap().keySet().size());
Iterator it = list.iterator();
assertSame(ColorEnum.RED, it.next());
assertSame(ColorEnum.GREEN, it.next());
@ -122,6 +128,12 @@ public final class EnumTest extends TestCase {
public void testMap() {
Map map = ColorEnum.getEnumMap();
assertNotNull(map);
assertEquals( map.keySet().size(),
ColorEnum.getEnumList().size());
assertTrue(map.containsValue(ColorEnum.RED));
assertTrue(map.containsValue(ColorEnum.GREEN));
assertTrue(map.containsValue(ColorEnum.BLUE));

View File

@ -66,7 +66,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 2002/08/11 23:17:54 scolebourne Exp $
* @version $Id: ValuedEnumTest.java,v 1.2 2002/10/13 18:42:06 sullis Exp $
*/
public final class ValuedEnumTest extends TestCase {
@ -120,6 +120,12 @@ public final class ValuedEnumTest extends TestCase {
public void testList() {
List list = ValuedColorEnum.getEnumList();
assertNotNull(list);
assertEquals( list.size(),
ValuedColorEnum.getEnumMap().keySet().size());
Iterator it = list.iterator();
assertSame(ValuedColorEnum.RED, it.next());
assertSame(ValuedColorEnum.GREEN, it.next());
@ -128,6 +134,12 @@ public final class ValuedEnumTest extends TestCase {
public void testMap() {
Map map = ValuedColorEnum.getEnumMap();
assertNotNull(map);
assertEquals( map.keySet().size(),
ValuedColorEnum.getEnumList().size());
assertTrue(map.containsValue(ValuedColorEnum.RED));
assertTrue(map.containsValue(ValuedColorEnum.GREEN));
assertTrue(map.containsValue(ValuedColorEnum.BLUE));