Recipe Name:
Use AssertJ's isEqualTo() instead of assertArrayEquals
Description:
Can be replaced with AssertJ style assertions
Level:
warning
Language:
  • java
Tags:
  • AssertJ
  • TestNG
Recipe
id: scw:assertj:junit-assert-array-equals
version: 10
metadata:
  name: Use AssertJ's isEqualTo() instead of assertArrayEquals
  shortDescription: Can be replaced with AssertJ style assertions
  level: warning
  language: java
  enabled: true
  tags: AssertJ; TestNG
search:
  methodcall:
    argCount: 2
    name: assertArrayEquals
    anyOf:
    - type: org.junit.Assert
    - type: org.junit.jupiter.api.Assertions
    - type: org.testng.internal.junit.ArrayAsserts
availableFixes:
- doStaticImports: true
  name: Change to assertThat(actualArray).isEqualTo(expectedArray)
  actions:
  - rewrite:
      to: org.assertj.core.api.Assertions.assertThat({{{ arguments.1 }}}).isEqualTo({{{ arguments.0 }}})