Supporting Multiple Answers: A Small Design Detour
Learn how to modify the classes and tests to support multiple answers.
We'll cover the following...
Scenario: Profile’s multiple answers
A profile can contain many answers, which the test tackles in this scenario. Here is the code for
ProfileTest
:
@Test
public void matchesWhenContainsMultipleAnswers() {
profile.add(answerThereIsRelocation);
profile.add(answerDoesNotReimburseTuition);
Criterion criterion =
new Criterion(answerThereIsRelocation, Weight.Important);
boolean result = profile.matches(criterion);
assertTrue(result);
}