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