November 2024
Intermediate to advanced
300 pages
7h 12m
English
A well-abstracted test emphasizes everything that’s important to understanding it and de-emphasizes anything that’s not. Any data used in a test should help tell its story.
Sometimes, you’re forced to supply data to get code to compile, even though that data is irrelevant to the test at hand. For example, a method might take additional arguments that have no impact on the test.
Your test contains some magic literals that aren’t at all clear:
| | var search = new Search(stream, "practical joke", "1"); |
And:
| | assertEquals(List.of( |
| | new Match("1", |
| | "practical joke", |
| | "or a vast practical ... |
Read now
Unlock full access