Another Small Increment
Learn adding new code chunks to the tests.
We'll cover the following...
The test demonstrates that matches
returns false
when the Profile
instance contains no matching Answer
object:
Press + to interact
public class ProfileTest {private Answer answerThereIsNotRelocation;// ...@Beforepublic void createQuestionAndAnswer() {questionIsThereRelocation =new BooleanQuestion(1, "Relocation package?");answerThereIsRelocation =new Answer(questionIsThereRelocation, Bool.TRUE);answerThereIsNotRelocation =new Answer(questionIsThereRelocation, Bool.FALSE);}// ...@Testpublic void doesNotMatchWhenNoMatchingAnswer() {profile.add(answerThereIsNotRelocation);Criterion criterion =new Criterion(answerThereIsRelocation, Weight.Important);boolean result = profile.matches(criterion);assertFalse(result);}}
Passing test
To get the test to pass, the ...