Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.3
    • Component/s: None
    • Labels:
      None

      Description

      Type

      Replacement of tokens.

      Approach

      The rule supports two types of simplifications:

      • "Context-free", the subject of the assertion is not taken into account.
        Providing a fix should be trivial, as it is already stated in the issue message.
      • Simplification "with context", where the subject is required.
        This case is a bit tricky, as it requires rewriting the entire assertion, keeping the relevant elements. The current implementation provides the correct assertion but does not keep the objects tested (replacing it with "actual"/"expected". Individually, supporting one simplification should be easy, the complexity comes from the fact that tens of simplifications should be supported.

      Before

      // "Context free"
      assertThat(getObject()).isEqualTo(null);
      // "With context"
      assertThat(getString().equals(x)).isTrue();
      assertThat(getCollection().size()).isLessThanOrEqualTo(length);
      assertThat(getMap().keySet()).contains("foo");
      

      After

      // "Context free"
      assertThat(getObject()).isNull();
      // "With context"
      assertThat(getString()).isEqualTo(x);
      assertThat(getCollection()).hasSizeLessThanOrEqualTo(length);
      assertThat(getMap()).containsKey("foo");
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              quentin.jaquier Quentin Jaquier
              Reporter:
              quentin.jaquier Quentin Jaquier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: