1 17 18 24 package javax.enterprise.deploy.shared; 25 26 import junit.framework.TestCase; 27 28 public class CommandTypeTest extends TestCase { 29 public void testValues() { 30 assertEquals(0, CommandType.DISTRIBUTE.getValue()); 31 assertEquals(1, CommandType.START.getValue()); 32 assertEquals(2, CommandType.STOP.getValue()); 33 assertEquals(3, CommandType.UNDEPLOY.getValue()); 34 assertEquals(4, CommandType.REDEPLOY.getValue()); 35 } 36 37 public void testToString() { 38 assertEquals("distribute", CommandType.DISTRIBUTE.toString()); 39 assertEquals("start", CommandType.START.toString()); 40 assertEquals("stop", CommandType.STOP.toString()); 41 assertEquals("undeploy", CommandType.UNDEPLOY.toString()); 42 assertEquals("redeploy", CommandType.REDEPLOY.toString()); 43 assertEquals("10", new ActionType(10).toString()); 45 assertEquals("-1", new ActionType(-1).toString()); 46 } 47 48 public void testValueToSmall() { 49 try { 50 CommandType.getCommandType(-1); 51 fail("Expected AIOOBE"); 52 } catch (ArrayIndexOutOfBoundsException aioobe) { 53 } 54 } 55 56 public void testValueToLarge() { 57 try { 58 CommandType.getCommandType(10); 59 fail("Expected AIOOBE"); 60 } catch (ArrayIndexOutOfBoundsException aioobe) { 61 } 62 } 63 } 64 | Popular Tags |