...

/

Supporting Multiple Answers: A Small Design Detour

Supporting Multiple Answers: A Small Design Detour

Learn how to modify the classes and tests to support multiple answers.

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 =
...
Access this course and 1400+ top-rated courses and projects.