Expanding the Interface

We’re now ready to open up our interface and support passing a Criteria object to matches(). The next test sets the stage for creating that interface:

public​ ​void​ doesNotMatchWhenNoneOfMultipleCriteriaMatch() {
Criteria criteria = ​new​ Criteria();
criteria.add(​new​ Criterion(answerThereIsRelo, Weight.Important));
criteria.add(​new​ Criterion(answerReimbursesTuition, Weight.Important));
boolean​ result = profile.matches(criteria);

A simple hardcoded return gets the test to pass:

public​ ​boolean​ matches(Criteria criteria) ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.