@Test public void noAnswerSelected() { questionPresenter.onAnswerSelected(R.id.answer_no); verify(view).setBackgroundColor(anyInt(), anyInt(), anyInt()); }
@Override public void onAnswerSelected(int id) { List<QuestionsContract> questions = this.listOfQuestions.getQuestion(); QuestionsContract questionsContract = questions.get(position); int selectedColor = questionsContract.getColor(); int unselectedColor = R.color.colorPrimary; String answer = null; switch (id) { case R.id.answer_yes: view.setBackgroundColor(selectedColor, unselectedColor, unselectedColor); answer = "yes"; break; case R.id.answer_no: view.setBackgroundColor(unselectedColor, selectedColor, unselectedColor); answer = "no"; break; case R.id.answer_unsure: view.setBackgroundColor(unselectedColor, unselectedColor, selectedColor); answer = "unsure"; break; default: break; } String answerTag = questionsContract.getAnswer(answer); String questionTag = questionsContract.getTag(); addAnswer(questionTag, answerTag); if (position == listOfQuestions.getNoOfQuestions() - 1) { view.createChangesetTags(); new Thread(new Runnable() { @Override public void run() { SourceContract.upload upload = new UploadToOSM(preferences); upload.uploadToOsm(); } }).start(); } }
QuestionPresenter implements QuestionFragmentContract.Presenter { @Override public void onAnswerSelected(int id) { List<QuestionsContract> questions = this.listOfQuestions.getQuestion(); QuestionsContract questionsContract = questions.get(position); int selectedColor = questionsContract.getColor(); int unselectedColor = R.color.colorPrimary; String answer = null; switch (id) { case R.id.answer_yes: view.setBackgroundColor(selectedColor, unselectedColor, unselectedColor); answer = "yes"; break; case R.id.answer_no: view.setBackgroundColor(unselectedColor, selectedColor, unselectedColor); answer = "no"; break; case R.id.answer_unsure: view.setBackgroundColor(unselectedColor, unselectedColor, selectedColor); answer = "unsure"; break; default: break; } String answerTag = questionsContract.getAnswer(answer); String questionTag = questionsContract.getTag(); addAnswer(questionTag, answerTag); if (position == listOfQuestions.getNoOfQuestions() - 1) { view.createChangesetTags(); new Thread(new Runnable() { @Override public void run() { SourceContract.upload upload = new UploadToOSM(preferences); upload.uploadToOsm(); } }).start(); } } }
QuestionPresenter implements QuestionFragmentContract.Presenter { @Override public void onAnswerSelected(int id) { List<QuestionsContract> questions = this.listOfQuestions.getQuestion(); QuestionsContract questionsContract = questions.get(position); int selectedColor = questionsContract.getColor(); int unselectedColor = R.color.colorPrimary; String answer = null; switch (id) { case R.id.answer_yes: view.setBackgroundColor(selectedColor, unselectedColor, unselectedColor); answer = "yes"; break; case R.id.answer_no: view.setBackgroundColor(unselectedColor, selectedColor, unselectedColor); answer = "no"; break; case R.id.answer_unsure: view.setBackgroundColor(unselectedColor, unselectedColor, selectedColor); answer = "unsure"; break; default: break; } String answerTag = questionsContract.getAnswer(answer); String questionTag = questionsContract.getTag(); addAnswer(questionTag, answerTag); if (position == listOfQuestions.getNoOfQuestions() - 1) { view.createChangesetTags(); new Thread(new Runnable() { @Override public void run() { SourceContract.upload upload = new UploadToOSM(preferences); upload.uploadToOsm(); } }).start(); } } QuestionPresenter(QuestionFragmentContract.View view, int position, SourceContract.Preferences preferences); }
QuestionPresenter implements QuestionFragmentContract.Presenter { @Override public void onAnswerSelected(int id) { List<QuestionsContract> questions = this.listOfQuestions.getQuestion(); QuestionsContract questionsContract = questions.get(position); int selectedColor = questionsContract.getColor(); int unselectedColor = R.color.colorPrimary; String answer = null; switch (id) { case R.id.answer_yes: view.setBackgroundColor(selectedColor, unselectedColor, unselectedColor); answer = "yes"; break; case R.id.answer_no: view.setBackgroundColor(unselectedColor, selectedColor, unselectedColor); answer = "no"; break; case R.id.answer_unsure: view.setBackgroundColor(unselectedColor, unselectedColor, selectedColor); answer = "unsure"; break; default: break; } String answerTag = questionsContract.getAnswer(answer); String questionTag = questionsContract.getTag(); addAnswer(questionTag, answerTag); if (position == listOfQuestions.getNoOfQuestions() - 1) { view.createChangesetTags(); new Thread(new Runnable() { @Override public void run() { SourceContract.upload upload = new UploadToOSM(preferences); upload.uploadToOsm(); } }).start(); } } QuestionPresenter(QuestionFragmentContract.View view, int position, SourceContract.Preferences preferences); @Override void getQuestion(); @Override void onAnswerSelected(int id); }
QuestionPresenter implements QuestionFragmentContract.Presenter { @Override public void onAnswerSelected(int id) { List<QuestionsContract> questions = this.listOfQuestions.getQuestion(); QuestionsContract questionsContract = questions.get(position); int selectedColor = questionsContract.getColor(); int unselectedColor = R.color.colorPrimary; String answer = null; switch (id) { case R.id.answer_yes: view.setBackgroundColor(selectedColor, unselectedColor, unselectedColor); answer = "yes"; break; case R.id.answer_no: view.setBackgroundColor(unselectedColor, selectedColor, unselectedColor); answer = "no"; break; case R.id.answer_unsure: view.setBackgroundColor(unselectedColor, unselectedColor, selectedColor); answer = "unsure"; break; default: break; } String answerTag = questionsContract.getAnswer(answer); String questionTag = questionsContract.getTag(); addAnswer(questionTag, answerTag); if (position == listOfQuestions.getNoOfQuestions() - 1) { view.createChangesetTags(); new Thread(new Runnable() { @Override public void run() { SourceContract.upload upload = new UploadToOSM(preferences); upload.uploadToOsm(); } }).start(); } } QuestionPresenter(QuestionFragmentContract.View view, int position, SourceContract.Preferences preferences); @Override void getQuestion(); @Override void onAnswerSelected(int id);  }