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:
parent
b759cf0bc6
commit
1ad5019544
|
@ -66,7 +66,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: 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 {
|
public final class EnumTest extends TestCase {
|
||||||
|
@ -114,6 +114,12 @@ public final class EnumTest extends TestCase {
|
||||||
|
|
||||||
public void testList() {
|
public void testList() {
|
||||||
List list = ColorEnum.getEnumList();
|
List list = ColorEnum.getEnumList();
|
||||||
|
|
||||||
|
assertNotNull(list);
|
||||||
|
|
||||||
|
assertEquals( list.size(),
|
||||||
|
ColorEnum.getEnumMap().keySet().size());
|
||||||
|
|
||||||
Iterator it = list.iterator();
|
Iterator it = list.iterator();
|
||||||
assertSame(ColorEnum.RED, it.next());
|
assertSame(ColorEnum.RED, it.next());
|
||||||
assertSame(ColorEnum.GREEN, it.next());
|
assertSame(ColorEnum.GREEN, it.next());
|
||||||
|
@ -122,6 +128,12 @@ public final class EnumTest extends TestCase {
|
||||||
|
|
||||||
public void testMap() {
|
public void testMap() {
|
||||||
Map map = ColorEnum.getEnumMap();
|
Map map = ColorEnum.getEnumMap();
|
||||||
|
|
||||||
|
assertNotNull(map);
|
||||||
|
|
||||||
|
assertEquals( map.keySet().size(),
|
||||||
|
ColorEnum.getEnumList().size());
|
||||||
|
|
||||||
assertTrue(map.containsValue(ColorEnum.RED));
|
assertTrue(map.containsValue(ColorEnum.RED));
|
||||||
assertTrue(map.containsValue(ColorEnum.GREEN));
|
assertTrue(map.containsValue(ColorEnum.GREEN));
|
||||||
assertTrue(map.containsValue(ColorEnum.BLUE));
|
assertTrue(map.containsValue(ColorEnum.BLUE));
|
||||||
|
|
|
@ -66,7 +66,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 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 {
|
public final class ValuedEnumTest extends TestCase {
|
||||||
|
@ -120,6 +120,12 @@ public final class ValuedEnumTest extends TestCase {
|
||||||
|
|
||||||
public void testList() {
|
public void testList() {
|
||||||
List list = ValuedColorEnum.getEnumList();
|
List list = ValuedColorEnum.getEnumList();
|
||||||
|
|
||||||
|
assertNotNull(list);
|
||||||
|
|
||||||
|
assertEquals( list.size(),
|
||||||
|
ValuedColorEnum.getEnumMap().keySet().size());
|
||||||
|
|
||||||
Iterator it = list.iterator();
|
Iterator it = list.iterator();
|
||||||
assertSame(ValuedColorEnum.RED, it.next());
|
assertSame(ValuedColorEnum.RED, it.next());
|
||||||
assertSame(ValuedColorEnum.GREEN, it.next());
|
assertSame(ValuedColorEnum.GREEN, it.next());
|
||||||
|
@ -128,6 +134,12 @@ public final class ValuedEnumTest extends TestCase {
|
||||||
|
|
||||||
public void testMap() {
|
public void testMap() {
|
||||||
Map map = ValuedColorEnum.getEnumMap();
|
Map map = ValuedColorEnum.getEnumMap();
|
||||||
|
|
||||||
|
assertNotNull(map);
|
||||||
|
|
||||||
|
assertEquals( map.keySet().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));
|
||||||
|
|
Loading…
Reference in New Issue