November 2024
Intermediate to advanced
300 pages
7h 12m
English
Always review your tests for opportunities to improve their readability. A few minutes of cleanup now can save countless developers from far more head-scratching time down the road.
Review your CreditHistory test. See if you can spot ways to improve things.
With but four lines, your test is already a mass of code demanding close attention:
| | @Test |
| | void withOneRatingHasEquivalentMean() { |
| | var creditHistory = new CreditHistory(); |
| | creditHistory.add(new CreditRating(780)); |
| | var result = creditHistory.arithmeticMean(); |
| | assertEquals(780, result); |
| | } |
The test has little scannability (as Mike Hill calls ...
Read now
Unlock full access