Recipe Name:
Use AssertJ's isEqualTo() (with message)
Description:
Can be replaced with AssertJ style assertions
Level:
warning
Language:
- java
Tags:
- AssertJ
- TestNG
Recipe
id: scw:assertj:junit-assert-equals-message version: 10 metadata: name: Use AssertJ's isEqualTo() (with message) shortDescription: Can be replaced with AssertJ style assertions level: warning language: java enabled: true tags: AssertJ; TestNG search: methodcall: argCount: 3 name: assertEquals anyOf: - args: 1: type: String type: org.junit.Assert - args: 1: type: String type: junit.framework.TestCase - args: 1: type: String type: junit.framework.Assert - args: 3: type: String type: org.junit.jupiter.api.Assertions - args: 1: type: String type: org.testng.AssertJUnit availableFixes: - doStaticImports: true name: Change to assertThat(actual).as(message).isEqualTo(expected) actions: - rewrite: applyIf: markedElement: is: methodcall: type: org.junit.jupiter.api.Assertions to: org.assertj.core.api.Assertions.assertThat({{{ arguments.1 }}}).as({{{ arguments.2 }}}).isEqualTo({{{ arguments.0 }}}) - rewrite: applyIf: markedElement: is: methodcall: type: not: org.junit.jupiter.api.Assertions checkInheritance: true to: org.assertj.core.api.Assertions.assertThat({{{ arguments.2 }}}).as({{{ arguments.0 }}}).isEqualTo({{{ arguments.1 }}})