diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitToAssertJRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitToAssertJRules.java index ca704aadea3..de0826a999e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitToAssertJRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/JUnitToAssertJRules.java @@ -99,14 +99,14 @@ void after(boolean condition, String message) { static final class AssertThatWithFailMessageSupplierIsTrue { @BeforeTemplate - void before(boolean condition, Supplier messageSupplier) { - assertTrue(condition, messageSupplier); + void before(boolean condition, Supplier supplier) { + assertTrue(condition, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(boolean condition, Supplier messageSupplier) { - assertThat(condition).withFailMessage(messageSupplier).isTrue(); + void after(boolean condition, Supplier supplier) { + assertThat(condition).withFailMessage(supplier).isTrue(); } } @@ -138,14 +138,14 @@ void after(boolean condition, String message) { static final class AssertThatWithFailMessageSupplierIsFalse { @BeforeTemplate - void before(boolean condition, Supplier messageSupplier) { - assertFalse(condition, messageSupplier); + void before(boolean condition, Supplier supplier) { + assertFalse(condition, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(boolean condition, Supplier messageSupplier) { - assertThat(condition).withFailMessage(messageSupplier).isFalse(); + void after(boolean condition, Supplier supplier) { + assertThat(condition).withFailMessage(supplier).isFalse(); } } @@ -261,14 +261,14 @@ void after(Object actual, Object expected, String message) { static final class AssertThatWithFailMessageSupplierIsSameAs { @BeforeTemplate - void before(Object actual, Object expected, Supplier messageSupplier) { - assertSame(expected, actual, messageSupplier); + void before(Object actual, Object expected, Supplier supplier) { + assertSame(expected, actual, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(Object actual, Object expected, Supplier messageSupplier) { - assertThat(actual).withFailMessage(messageSupplier).isSameAs(expected); + void after(Object actual, Object expected, Supplier supplier) { + assertThat(actual).withFailMessage(supplier).isSameAs(expected); } } @@ -300,14 +300,14 @@ void after(Object actual, Object expected, String message) { static final class AssertThatWithFailMessageSupplierIsNotSameAs { @BeforeTemplate - void before(Object actual, Object expected, Supplier messageSupplier) { - assertNotSame(expected, actual, messageSupplier); + void before(Object actual, Object expected, Supplier supplier) { + assertNotSame(expected, actual, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(Object actual, Object expected, Supplier messageSupplier) { - assertThat(actual).withFailMessage(messageSupplier).isNotSameAs(expected); + void after(Object actual, Object expected, Supplier supplier) { + assertThat(actual).withFailMessage(supplier).isNotSameAs(expected); } } @@ -344,14 +344,14 @@ void after(ThrowingCallable runnable, Class clazz, String message) { static final class AssertThatThrownByWithFailMessageSupplierIsExactlyInstanceOf< T extends Throwable> { @BeforeTemplate - void before(Executable runnable, Class clazz, Supplier messageSupplier) { - assertThrowsExactly(clazz, runnable, messageSupplier); + void before(Executable runnable, Class clazz, Supplier supplier) { + assertThrowsExactly(clazz, runnable, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(ThrowingCallable runnable, Class clazz, Supplier messageSupplier) { - assertThatThrownBy(runnable).withFailMessage(messageSupplier).isExactlyInstanceOf(clazz); + void after(ThrowingCallable runnable, Class clazz, Supplier supplier) { + assertThatThrownBy(runnable).withFailMessage(supplier).isExactlyInstanceOf(clazz); } } @@ -383,14 +383,14 @@ void after(ThrowingCallable runnable, Class clazz, String message) { static final class AssertThatThrownByWithFailMessageSupplierIsInstanceOf { @BeforeTemplate - void before(Executable runnable, Class clazz, Supplier messageSupplier) { - assertThrows(clazz, runnable, messageSupplier); + void before(Executable runnable, Class clazz, Supplier supplier) { + assertThrows(clazz, runnable, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(ThrowingCallable runnable, Class clazz, Supplier messageSupplier) { - assertThatThrownBy(runnable).withFailMessage(messageSupplier).isInstanceOf(clazz); + void after(ThrowingCallable runnable, Class clazz, Supplier supplier) { + assertThatThrownBy(runnable).withFailMessage(supplier).isInstanceOf(clazz); } } @@ -432,19 +432,19 @@ void after(ThrowingCallable runnable, String message) { static final class AssertThatCodeWithFailMessageSupplierDoesNotThrowAnyException { @BeforeTemplate - void before(Executable runnable, Supplier messageSupplier) { - assertDoesNotThrow(runnable, messageSupplier); + void before(Executable runnable, Supplier supplier) { + assertDoesNotThrow(runnable, supplier); } @BeforeTemplate - void before(ThrowingSupplier runnable, Supplier messageSupplier) { - assertDoesNotThrow(runnable, messageSupplier); + void before(ThrowingSupplier runnable, Supplier supplier) { + assertDoesNotThrow(runnable, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(ThrowingCallable runnable, Supplier messageSupplier) { - assertThatCode(runnable).withFailMessage(messageSupplier).doesNotThrowAnyException(); + void after(ThrowingCallable runnable, Supplier supplier) { + assertThatCode(runnable).withFailMessage(supplier).doesNotThrowAnyException(); } } @@ -479,14 +479,14 @@ void after(Object object, Class clazz, String message) { static final class AssertThatWithFailMessageSupplierIsInstanceOf { @BeforeTemplate - void before(Object object, Class clazz, Supplier messageSupplier) { - assertInstanceOf(clazz, object, messageSupplier); + void before(Object object, Class clazz, Supplier supplier) { + assertInstanceOf(clazz, object, supplier); } @AfterTemplate @UseImportPolicy(STATIC_IMPORT_ALWAYS) - void after(Object object, Class clazz, Supplier messageSupplier) { - assertThat(object).withFailMessage(messageSupplier).isInstanceOf(clazz); + void after(Object object, Class clazz, Supplier supplier) { + assertThat(object).withFailMessage(supplier).isInstanceOf(clazz); } } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestInput.java index 66a3cd717ac..9fdcd9433b3 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestInput.java @@ -20,16 +20,16 @@ final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase { public ImmutableSet elidedTypesAndStaticImports() { return ImmutableSet.of( (Runnable) () -> assertDoesNotThrow(() -> null), - (Runnable) () -> assertFalse(true), - (Runnable) () -> assertInstanceOf(null, null), - (Runnable) () -> assertNotNull(null), - (Runnable) () -> assertNotSame(null, null), - (Runnable) () -> assertNull(null), - (Runnable) () -> assertSame(null, null), - (Runnable) () -> assertThrows(null, null), - (Runnable) () -> assertThrowsExactly(null, null), - (Runnable) () -> assertTrue(true), - (Runnable) () -> Assertions.fail()); + () -> assertFalse(true), + () -> assertInstanceOf(null, null), + () -> assertNotNull(null), + () -> assertNotSame(null, null), + () -> assertNull(null), + () -> assertSame(null, null), + () -> assertThrows(null, null), + () -> assertThrowsExactly(null, null), + () -> assertTrue(true), + () -> Assertions.fail()); } void testThrowNewAssertionError() { diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestOutput.java index 5ab2e17592d..b7d3aa159b2 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/JUnitToAssertJRulesTestOutput.java @@ -24,16 +24,16 @@ final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase { public ImmutableSet elidedTypesAndStaticImports() { return ImmutableSet.of( (Runnable) () -> assertDoesNotThrow(() -> null), - (Runnable) () -> assertFalse(true), - (Runnable) () -> assertInstanceOf(null, null), - (Runnable) () -> assertNotNull(null), - (Runnable) () -> assertNotSame(null, null), - (Runnable) () -> assertNull(null), - (Runnable) () -> assertSame(null, null), - (Runnable) () -> assertThrows(null, null), - (Runnable) () -> assertThrowsExactly(null, null), - (Runnable) () -> assertTrue(true), - (Runnable) () -> Assertions.fail()); + () -> assertFalse(true), + () -> assertInstanceOf(null, null), + () -> assertNotNull(null), + () -> assertNotSame(null, null), + () -> assertNull(null), + () -> assertSame(null, null), + () -> assertThrows(null, null), + () -> assertThrowsExactly(null, null), + () -> assertTrue(true), + () -> Assertions.fail()); } void testThrowNewAssertionError() {