/** パーセント入力時の状態確認 */ @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))); }
/** 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")); }
/** 四則演算入力時の表示 */ @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")); }