Recipe Name:
Use isNotEqualTo instead of equals isFalse
Description:
Use isNotEqualTo instead of equals isFalse
Level:
warning
Language:
  • java
Tags:
  • AssertJ
  • framework specific
  • quality
Recipe
id: scw:assertj:idiomatic:isNotEqualTo-methodcall-false
version: 10
metadata:
  name: Use isNotEqualTo instead of equals isFalse
  shortDescription: Use isNotEqualTo instead of equals isFalse
  level: warning
  language: java
  enabled: true
  tags: AssertJ;framework specific;quality
search:
  methodcall:
    name: isFalse
    anyOf:
    - "on":
        methodcall:
          args:
            1:
              value:
                is:
                  methodcall:
                    argCount: 1
                    name: equals
          name: assertThat
          label: assertThatMethodCallDirect
          type: org.assertj.core.api.Assertions
    - "on":
        methodcall:
          name:
            matches: as|describedAs
          "on":
            methodcall:
              args:
                1:
                  value:
                    is:
                      methodcall:
                        argCount: 1
                        name: equals
              name: assertThat
              label: assertThatMethodCallIndirect
              type: org.assertj.core.api.Assertions
availableFixes:
- name: Use idiomatic assertion
  actions:
  - modifyArguments:
      rewrite:
        1: '{{{ qualifier }}}'
      target: label:assertThatMethodCallDirect
  - modifyArguments:
      rewrite:
        1: '{{{ qualifier }}}'
      target: label:assertThatMethodCallIndirect
  - modifyArguments:
      applyIf:
        label:
          is:
            methodcall: {}
          labelName: assertThatMethodCallDirect
      insert:
        1: '{{{ qualifier.arguments.0.arguments }}}'
  - modifyArguments:
      applyIf:
        label:
          is:
            methodcall: {}
          labelName: assertThatMethodCallIndirect
      insert:
        1: '{{{ qualifier.qualifier.arguments.0.arguments }}}'
  - changeName:
      name: isNotEqualTo