Пример #1
0
 @Test
 public void testParseInputToCommand13() {
   List<Double> list = new ArrayList<Double>();
   list.add(1.0);
   list.add(2.0);
   String vaildInput = "add 1 !0 2 3";
   History.addToHistory(new AddCmd(list).calculate());
   Command output = Parser.parseInputToCommand(vaildInput);
   assertEquals(AddCmd.class, output.getClass());
 }
Пример #2
0
 @Test
 public void testparseInputToCommand11() {
   History.clearHistory();
   String validInput = "add 1 !1";
   /*
    * we expect there to be an error because the history logging is done by
    * the driver and therefore the parser will have no way of knowing if a
    * historic value was computed on its own
    */
   try {
     Command output = Parser.parseInputToCommand(validInput);
     fail();
   } catch (IllegalArgumentException e) {
     assertEquals("The index 1 has no associated history", e.getMessage());
   }
 }