Test Setup Is Somewhere Else

Definition:

  • Where the test method just does the assertions, not the given/when part; this can be acceptable in the case of several tests on a single shared expensive resource setup, but seldom is at other times.

Code Example:

@Test
void theOperationIsSuccessful() {
    assertTrue(service.isLastOperationSuccessful());
}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring