Test Tautology

Definition:

  • Generally speaking one does not want to duplicate the logic between tests and code. So replicating a regexp or something else in the test is not an option.

Code Example:

Assertions.assertThat(processTemplate("param1", "param2")).isEqualTo(String.format("this is '%s', and this is '%s'", param1, param2));

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring