public void testIHasAMixedCase() {
   CompilerState cs = new MockCompilerState();
   IHasACommand cmd = (IHasACommand) CommandFactory.instance().getCommand("I HAS A FisH");
   cmd.compile(cs);
   assertHasVar(cs, "FisH");
   assertNull(cmd.getExpression());
 }
 public void testIHasAMixedCaseIsNotSame() {
   CompilerState cs = new MockCompilerState();
   cs.addVar("ALREADY");
   IHasACommand cmd = (IHasACommand) CommandFactory.instance().getCommand("I HAS A ALreadY");
   cmd.compile(cs);
   assertHasVar(cs, "ALreadY");
   assertHasVar(cs, "ALREADY");
 }
 public void testIHasAWithValue() {
   CompilerState cs = new MockCompilerState();
   IHasACommand cmd = (IHasACommand) CommandFactory.instance().getCommand("I HAS A FISH ITZ 4");
   cmd.compile(cs);
   assertHasVar(cs, "FISH");
   assertNotNull(cmd.getExpression());
   assertInstanceOf(cmd.getExpression(), ValueExpression.class);
   assertEquals("4", cmd.getExpression().evaluate().strVal());
 }
 public void testIHasAValueBadItz() {
   CompilerState cs = new MockCompilerState();
   Command cmd = CommandFactory.instance().getCommand("I HAS A FISH IZ 4");
   try {
     cmd.compile(cs);
     fail("Should have thrown exception.");
   } catch (ImproperCommandConstructionException e) {
     // yay
   }
 }
 public void testIHasANoArg() {
   CompilerState cs = new MockCompilerState();
   Command cmd = CommandFactory.instance().getCommand("I HAS A ");
   try {
     cmd.compile(cs);
     fail("Should have thrown exception.");
   } catch (MissingIdentifierException e) {
     // yay
   }
 }
 public void testIHasAKeyword() {
   CompilerState cs = new MockCompilerState();
   Command cmd = CommandFactory.instance().getCommand("I HAS A " + Univar.TRUE);
   try {
     cmd.compile(cs);
     fail("Should have thrown exception.");
   } catch (BadIdentifierException e) {
     // yay
   }
 }
 public void testIHasAAlready() {
   CompilerState cs = new MockCompilerState();
   cs.addVar("ALREADY");
   Command cmd = CommandFactory.instance().getCommand("I HAS A ALREADY");
   try {
     cmd.compile(cs);
     fail("Should have thrown exception.");
   } catch (IdentifierAlreadyDeclaredException e) {
     // yay
   }
 }