March 2015
Intermediate to advanced
236 pages
5h 26m
English
A profile can contain many answers, so the next test tackles that scenario:
| iloveyouboss/tdd-10/test/iloveyouboss/ProfileTest.java | |
| | @Test |
| | public void matchesWhenContainsMultipleAnswers() { |
| | profile.add(answerThereIsRelocation); |
| | profile.add(answerDoesNotReimburseTuition); |
| | Criterion criterion = |
| | new Criterion(answerThereIsRelocation, Weight.Important); |
| | |
| | boolean result = profile.matches(criterion); |
| | |
| | assertTrue(result); |
| | } |
Having multiple Answers in the Profile requires a way to store and distinguish them. We choose to store the Answers in a Map where the key is the question text and the value is the associated Answer. (It’d probably be better to use an Answer ID as the key, ...
Read now
Unlock full access