1 51 package org.apache.avalon.framework.test; 52 53 import junit.framework.TestCase; 54 import org.apache.avalon.framework.Enum; 55 56 61 public class EnumTestCase 62 extends TestCase 63 { 64 private final static class Color extends Enum 65 { 66 public static final Color RED = new Color( "Red" ); 67 public static final Color GREEN = new Color( "Green" ); 68 public static final Color BLUE = new Color( "Blue" ); 69 70 private Color( final String color ) 71 { 72 super( color ); 73 } 74 } 75 76 private final static class OtherColor extends Enum 77 { 78 public static final OtherColor RED = new OtherColor( "Red" ); 79 public static final OtherColor GREEN = new OtherColor( "Green" ); 80 public static final OtherColor BLUE = new OtherColor( "Blue" ); 81 82 private OtherColor( final String color ) 83 { 84 super( color ); 85 } 86 } 87 88 public EnumTestCase( final String name ) 89 { 90 super( name ); 91 } 92 93 public void testEquality () 94 { 95 assertTrue( Color.RED.equals( Color.RED ) ); 96 assertTrue( Color.GREEN.equals( Color.GREEN ) ); 97 assertTrue( Color.BLUE.equals( Color.BLUE ) ); 98 99 assertTrue( !OtherColor.RED.equals( Color.RED ) ); 100 assertTrue( !OtherColor.GREEN.equals( Color.GREEN ) ); 101 assertTrue( !OtherColor.BLUE.equals( Color.BLUE ) ); 102 103 assertTrue( !Color.RED.equals( OtherColor.RED ) ); 104 assertTrue( !Color.GREEN.equals( OtherColor.GREEN ) ); 105 assertTrue( !Color.BLUE.equals( OtherColor.BLUE ) ); 106 107 assertTrue( !Color.RED.equals( Color.GREEN ) ); 108 assertTrue( !Color.GREEN.equals( Color.BLUE ) ); 109 assertTrue( !Color.BLUE.equals( Color.RED ) ); 110 } 111 } 112 | Popular Tags |