Exemplo n.º 1
0
 /** パーセント入力時の状態確認 */
 @Test
 public void inputPercentNextState() {
   State state = new RightInputState();
   Formula formula = new Formula();
   formula.setRight("1");
   State nextState = state.inputPercent(formula);
   Assert.assertThat(nextState, is(instanceOf(RightInputState.class)));
 }
Exemplo n.º 2
0
 /** イコール入力時の次の状態確認 */
 @Test
 public void inputEqualeNextState() {
   State state = new RightInputState();
   Formula formula = new Formula();
   formula.setOperation(Operation.ADD);
   State nextState = state.inputEquale(formula);
   Assert.assertThat(nextState, is(instanceOf(EqualInputState.class)));
 }
Exemplo n.º 3
0
 /** 0〜9入力時の表示 */
 @Test
 public void inputNumberDisplay() {
   State state = new RightInputState();
   Formula formula = new Formula();
   formula.setRight("1");
   state.inputNumber(formula, "5");
   String actual = state.getDisplayNumber(formula);
   Assert.assertThat(actual, is("15"));
 }
Exemplo n.º 4
0
 /** 四則演算入力時の表示 */
 @Test
 public void inputOperationDisplay() {
   State state = new RightInputState();
   Formula formula = new Formula();
   formula.setLeft("1");
   formula.setRight("5");
   formula.setOperation(Operation.ADD);
   state.inputOperation(formula, Operation.ADD);
   String actual = state.getDisplayNumber(formula);
   Assert.assertThat(actual, is("5"));
 }