March 2015
Intermediate to advanced
236 pages
5h 26m
English
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:
| iloveyouboss/tdd-11/test/iloveyouboss/ProfileTest.java | |
| | @Test |
| | public void doesNotMatchWhenNoneOfMultipleCriteriaMatch() { |
| | profile.add(answerDoesNotReimburseTuition); |
| | Criteria criteria = new Criteria(); |
| | criteria.add(new Criterion(answerThereIsRelo, Weight.Important)); |
| | criteria.add(new Criterion(answerReimbursesTuition, Weight.Important)); |
| | |
| | boolean result = profile.matches(criteria); |
| | |
| | assertFalse(result); |
| | } |
A simple hardcoded return gets the test to pass:
| iloveyouboss/tdd-11/src/iloveyouboss/Profile.java | |
| | public boolean matches(Criteria criteria) ... |
Read now
Unlock full access