Recipe Name:
Use AssertJ's isFalse()
Description:
Can be replaced with AssertJ style assertions
Level:
warning
Language:
  • java
Tags:
  • AssertJ
  • TestNG
Recipe
id: scw:assertj:testng-assert-false
version: 10
metadata:
  name: Use AssertJ's isFalse()
  shortDescription: Can be replaced with AssertJ style assertions
  level: warning
  language: java
  enabled: true
  tags: AssertJ; TestNG
search:
  methodcall:
    args:
      1:
        anyOf:
        - type: java.lang.Boolean
        - type: boolean
    argCount:
      lessThanOrEquals: 2
      greaterThanOrEquals: 1
    name: assertFalse
    type: org.testng.Assert
availableFixes:
- doStaticImports: true
  name: Change to assertThat(actual).isFalse()
  availableIf:
    markedElement:
      is:
        methodcall:
          argCount: 1
  actions:
  - rewrite:
      to: org.assertj.core.api.Assertions.assertThat({{{ arguments.0 }}}).isFalse()
- doStaticImports: true
  name: Change to assertThat(actual).as(message).isFalse()
  availableIf:
    markedElement:
      is:
        methodcall:
          argCount: 2
  actions:
  - rewrite:
      to: org.assertj.core.api.Assertions.assertThat({{{ arguments.0 }}}).as({{{ arguments.1 }}}).isFalse()