The First And Last Rites
Definition:
Where there’s some ritual/boilerplate at the start and end of most test bodies, suggesting a lack of common setup/teardown code
Also Known As:
Oops I Forgot The Setup
Code Example:
@Test
public void connectionWorks() {
database = openDatabase();
database.healthCheck();
database.close();
}
@Test
public void countRows() {
database = openDatabase();
assertThat(database.countAll())
.isEqualTo(0);
database.close();
}
References:
Quality attributes
- Code Example
- Cause and Effect
- Frequency
- Refactoring