Another Small Increment

The next test demonstrates that matches returns false when the Profile instance contains no matching Answer object:

iloveyouboss/tdd-9/test/iloveyouboss/ProfileTest.java
 
public​ ​class​ ProfileTest {
*
private​ Answer answerThereIsNotRelocation;
 
// ...
 
@Before
 
public​ ​void​ createQuestionAndAnswer() {
 
questionIsThereRelocation =
 
new​ BooleanQuestion(1, ​"Relocation package?"​);
 
answerThereIsRelocation =
 
new​ Answer(questionIsThereRelocation, Bool.TRUE);
*
answerThereIsNotRelocation =
*
new​ Answer(questionIsThereRelocation, Bool.FALSE);
 
}
 
// ...
*
@Test
*
public​ ​void​ doesNotMatchWhenNoMatchingAnswer() {
*
profile.add(answerThereIsNotRelocation);
*
Criterion criterion =
*
new​ Criterion(answerThereIsRelocation, ...

Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.