Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Tests should not be public

  • Instance variables should have no modifiers

  • Constants have to be private static final

  • If tests throw any exception, they must throw Exception.class only

  • Testclass name pattern:

    • rest: Start with the name of the tested class or description of the tested behavior, end with “IntTest” or “RestDocTest”, e.g. TaskControllerIntTest

    • lib: Start with the name of the tested class or description of the tested behavior, end with “AccTest”, e.g. UpdateTaskAccTest

  • Assertions

    • We are using AssertJ only

    • Concatenate the assertions if possible

    • We are strictly using the AssertJ fluent syntax. This means assertThat(<testObject>).<operation>
      examples:
      BAD: assertThat(string.contains(“foo”)).isTrue();
      GOOD: assertThat(string).contains(“foo”);
      General Rule: Do not use any operation within the assertThat() function. Use existing functions from AssertJ’s assert classes.

    • We want to use extracting instead of explicit extracting for collection-type entities.

      • e.g.

        Code Block
        assertThat(events)
            .extracting(WorkbasketHistoryEvent::getEventType)
            .containsExactly(WorkbasketHistoryEventType.DISTRIBUTION_TARGET_ADDED.getName());

        instead of

        Code Block
        type = events.get(0).getEventType();
        assertThat(type).isEqualTo(WorkbasketHistoryEventType.DISTRIBUTION_TARGET_ADDED.getName());

...