StandardQuestionModel implements QuestionModel { public void saveState(StateSaver stateSaver) { stateSaver.saveInt(KEY_INDEX, currentIndex); } StandardQuestionModel(Question[] questions); @Override String getQuestionText(); @Override boolean isCheater(); @Override boolean isCorrectAnswer(boolean answer); @Override void gotoNextQuestion(); @Override void cheatRequested(); @Override void whenQuestionTextChanged(EventListener listener); void whenCheatRequested(DataEventListener<Boolean> listener); void setCheater(boolean isCheater); void saveState(StateSaver stateSaver); void loadState(StateLoader stateLoader);  }
@Test public void saveState_savesTheCurrentQuestionIndex_whenCalled() { StandardQuestionModel model = new StandardQuestionModel(new Question[]{ new Question("question1", true), }); StateSaver stateSaver = mock(StateSaver.class); model.saveState(stateSaver); verify(stateSaver).saveInt("index", 0); }