March 2015
Intermediate to advanced
236 pages
5h 26m
English
The tests we built in Chapter 1, Building Your First JUnit Test are short—four lines of code each. We might consider combining them:
| iloveyouboss/12/test/iloveyouboss/ProfileTest.java | |
| | @Test |
| | public void matches() { |
| | Profile profile = new Profile("Bull Hockey, Inc."); |
| | Question question = new BooleanQuestion(1, "Got milk?"); |
| | |
| | // answers false when must-match criteria not met |
| | profile.add(new Answer(question, Bool.FALSE)); |
| | Criteria criteria = new Criteria(); |
| | criteria.add( |
| | new Criterion(new Answer(question, Bool.TRUE), Weight.MustMatch)); |
| | |
| | assertFalse(profile.matches(criteria)); |
| | |
| | // answers true for any don't care criteria |
| | profile.add(new Answer(question, ... |
Read now
Unlock full access