March 2015
Intermediate to advanced
236 pages
5h 26m
English
We first saw the StatCompiler code in [F]IRST: [F]ast!. We were able to refactor this class so that most of its code doesn’t directly interact with a QuestionController instance, which in turn let us write fast tests for the bulk of its logic. We were left with one method, questionText(), that interacts with a controller object, and we’d now like to test that method:
| iloveyouboss/16-branch-persistence-redesign/src/iloveyouboss/domain/StatCompiler.java | |
| | public Map<Integer,String> questionText(List<BooleanAnswer> answers) { |
| | Map<Integer,String> questions = new HashMap<>(); |
| | answers.stream().forEach(answer -> { |
| | if (!questions.containsKey(answer.getQuestionId())) |
| | questions.put(answer.getQuestionId(), ... |
Read now
Unlock full access