/** イコール入力時の次の状態確認 */ @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))); }
/** 四則演算入力時の表示 */ @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")); }