November 2024
Intermediate to advanced
300 pages
7h 12m
English
Speed up cognition by making the act, arrange, and assert parts of a test (see Scannability: Arrange—Act—Assert) explicit. Arrows in the following listing show the blank lines to insert around the act step:
| | @Test |
| | void returnsMatchesWithSurroundingContext() { |
| | var stream = streamOn("There are certain queer times and occasions " |
| | // ... |
| | var search = new Search(stream, "practical joke", A_TITLE); |
| | search.setSurroundingCharacterCount(10); |
| » | |
| | search.execute(); |
| » | |
| | var matches = search.getMatches(); |
| | assertEquals(List.of( |
| | new Match(A_TITLE, |
| | "practical joke", |
| | "or a vast practical joke, though t")), |
| | matches); |
| | } |
| | |
| | @Test ... |
Read now
Unlock full access