From 19f7bf2a3435d4591991150e81a6642cac57e274 Mon Sep 17 00:00:00 2001 From: CoolTomatos Date: Tue, 6 Sep 2022 17:21:14 +0200 Subject: [PATCH] Trying to fix the build. --- .../AssertJByteTemplates.java | 88 ------------------- .../AssertJComparableTemplates.java | 27 ++---- .../AssertJFloatTemplates.java | 88 ------------------- .../AssertJIntegerTemplates.java | 88 ------------------- .../AssertJLongTemplates.java | 88 ------------------- .../AssertJShortTemplates.java | 88 ------------------- .../AssertJByteTemplatesTestInput.java | 31 ------- .../AssertJByteTemplatesTestOutput.java | 33 ------- .../AssertJComparableTemplatesTestInput.java | 27 ++---- .../AssertJComparableTemplatesTestOutput.java | 27 ++---- .../AssertJFloatTemplatesTestInput.java | 25 ------ .../AssertJFloatTemplatesTestOutput.java | 27 ------ .../AssertJIntegerTemplatesTestInput.java | 26 ------ .../AssertJIntegerTemplatesTestOutput.java | 28 ------ .../AssertJLongTemplatesTestInput.java | 25 ------ .../AssertJLongTemplatesTestOutput.java | 27 ------ .../AssertJShortTemplatesTestInput.java | 31 ------- .../AssertJShortTemplatesTestOutput.java | 35 -------- 18 files changed, 25 insertions(+), 784 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java index ad601491d94..220e3001e7b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJByteTemplates.java @@ -1,15 +1,11 @@ package tech.picnic.errorprone.refastertemplates; -import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.assertj.core.data.Percentage.withPercentage; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; -import com.google.errorprone.refaster.annotation.UseImportPolicy; -import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractByteAssert; final class AssertJByteTemplates { @@ -28,20 +24,6 @@ AbstractByteAssert after(AbstractByteAssert byteAssert, byte n) { } } - static final class AbstractByteAssertActualIsEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(byte actual, byte expected) { - return Refaster.anyOf( - assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractByteAssert after(byte actual, byte expected) { - return assertThat(actual).isEqualTo(expected); - } - } - static final class AbstractByteAssertIsNotEqualTo { @BeforeTemplate AbstractByteAssert before(AbstractByteAssert byteAssert, byte n) { @@ -56,20 +38,6 @@ AbstractByteAssert after(AbstractByteAssert byteAssert, byte n) { } } - static final class AbstractByteAssertActualIsNotEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(byte actual, byte expected) { - return Refaster.anyOf( - assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractByteAssert after(byte actual, byte expected) { - return assertThat(actual).isNotEqualTo(expected); - } - } - static final class AbstractByteAssertIsZero { @BeforeTemplate AbstractByteAssert before(AbstractByteAssert byteAssert) { @@ -105,60 +73,4 @@ AbstractByteAssert after(AbstractByteAssert byteAssert) { return byteAssert.isEqualTo((byte) 1); } } - - static final class AbstractByteAssertActualIsLessThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(byte actual, byte expected) { - return Refaster.anyOf( - assertThat(actual < expected).isTrue(), assertThat(actual >= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractByteAssert after(byte actual, byte expected) { - return assertThat(actual).isLessThan(expected); - } - } - - static final class AbstractByteAssertActualIsLessThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(byte actual, byte expected) { - return Refaster.anyOf( - assertThat(actual <= expected).isTrue(), assertThat(actual > expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractByteAssert after(byte actual, byte expected) { - return assertThat(actual).isLessThanOrEqualTo(expected); - } - } - - static final class AbstractByteAssertActualIsGreaterThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(byte actual, byte expected) { - return Refaster.anyOf( - assertThat(actual > expected).isTrue(), assertThat(actual <= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractByteAssert after(byte actual, byte expected) { - return assertThat(actual).isGreaterThan(expected); - } - } - - static final class AbstractByteAssertActualIsGreaterThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(byte actual, byte expected) { - return Refaster.anyOf( - assertThat(actual >= expected).isTrue(), assertThat(actual < expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractByteAssert after(byte actual, byte expected) { - return assertThat(actual).isGreaterThanOrEqualTo(expected); - } - } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java index 5a81df71015..e10eb1577d1 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplates.java @@ -3,12 +3,11 @@ import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; import static org.assertj.core.api.Assertions.assertThat; -import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; import com.google.errorprone.refaster.annotation.UseImportPolicy; -import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractComparableAssert; +import org.assertj.core.api.AbstractIntegerAssert; final class AssertJComparableTemplates { private AssertJComparableTemplates() {} @@ -16,10 +15,8 @@ private AssertJComparableTemplates() {} static final class AbstractComparableAssertActualIsLessThanExpected< T extends Comparable> { @BeforeTemplate - AbstractBooleanAssert before(T actual, T expected) { - return Refaster.anyOf( - assertThat(actual.compareTo(expected) < 0).isTrue(), - assertThat(actual.compareTo(expected) >= 0).isFalse()); + AbstractIntegerAssert before(T actual, T expected) { + return assertThat(actual.compareTo(expected)).isNegative(); } @AfterTemplate @@ -32,10 +29,8 @@ AbstractBooleanAssert before(T actual, T expected) { static final class AbstractComparableAssertActualIsLessThanOrEqualToExpected< T extends Comparable> { @BeforeTemplate - AbstractBooleanAssert before(T actual, T expected) { - return Refaster.anyOf( - assertThat(actual.compareTo(expected) <= 0).isTrue(), - assertThat(actual.compareTo(expected) > 0).isFalse()); + AbstractIntegerAssert before(T actual, T expected) { + return assertThat(actual.compareTo(expected)).isNotPositive(); } @AfterTemplate @@ -48,10 +43,8 @@ AbstractBooleanAssert before(T actual, T expected) { static final class AbstractComparableAssertActualIsGreaterThanExpected< T extends Comparable> { @BeforeTemplate - AbstractBooleanAssert before(T actual, T expected) { - return Refaster.anyOf( - assertThat(actual.compareTo(expected) > 0).isTrue(), - assertThat(actual.compareTo(expected) <= 0).isFalse()); + AbstractIntegerAssert before(T actual, T expected) { + return assertThat(actual.compareTo(expected)).isPositive(); } @AfterTemplate @@ -64,10 +57,8 @@ AbstractBooleanAssert before(T actual, T expected) { static final class AbstractComparableAssertActualIsGreaterThanOrEqualToExpected< T extends Comparable> { @BeforeTemplate - AbstractBooleanAssert before(T actual, T expected) { - return Refaster.anyOf( - assertThat(actual.compareTo(expected) >= 0).isTrue(), - assertThat(actual.compareTo(expected) < 0).isFalse()); + AbstractIntegerAssert before(T actual, T expected) { + return assertThat(actual.compareTo(expected)).isNotNegative(); } @AfterTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java index 06afbc36db8..6de54b99cb7 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplates.java @@ -1,15 +1,11 @@ package tech.picnic.errorprone.refastertemplates; -import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.assertj.core.data.Percentage.withPercentage; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; -import com.google.errorprone.refaster.annotation.UseImportPolicy; -import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractFloatAssert; import org.assertj.core.data.Offset; @@ -49,20 +45,6 @@ AbstractFloatAssert after(AbstractFloatAssert floatAssert, float n) { } } - static final class AbstractFloatAssertActualIsEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(float actual, float expected) { - return Refaster.anyOf( - assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractFloatAssert after(float actual, float expected) { - return assertThat(actual).isEqualTo(expected); - } - } - static final class AbstractFloatAssertIsNotEqualTo { @BeforeTemplate AbstractFloatAssert before(AbstractFloatAssert floatAssert, float n) { @@ -76,20 +58,6 @@ AbstractFloatAssert after(AbstractFloatAssert floatAssert, float n) { } } - static final class AbstractFloatAssertActualIsNotEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(float actual, float expected) { - return Refaster.anyOf( - assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractFloatAssert after(float actual, float expected) { - return assertThat(actual).isNotEqualTo(expected); - } - } - static final class AbstractFloatAssertIsZero { @BeforeTemplate AbstractFloatAssert before(AbstractFloatAssert floatAssert) { @@ -125,60 +93,4 @@ AbstractFloatAssert after(AbstractFloatAssert floatAssert) { return floatAssert.isEqualTo(1); } } - - static final class AbstractFloatAssertActualIsLessThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(float actual, float expected) { - return Refaster.anyOf( - assertThat(actual < expected).isTrue(), assertThat(actual >= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractFloatAssert after(float actual, float expected) { - return assertThat(actual).isLessThan(expected); - } - } - - static final class AbstractFloatAssertActualIsLessThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(float actual, float expected) { - return Refaster.anyOf( - assertThat(actual <= expected).isTrue(), assertThat(actual > expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractFloatAssert after(float actual, float expected) { - return assertThat(actual).isLessThanOrEqualTo(expected); - } - } - - static final class AbstractFloatAssertActualIsGreaterThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(float actual, float expected) { - return Refaster.anyOf( - assertThat(actual > expected).isTrue(), assertThat(actual <= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractFloatAssert after(float actual, float expected) { - return assertThat(actual).isGreaterThan(expected); - } - } - - static final class AbstractFloatAssertActualIsGreaterThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(float actual, float expected) { - return Refaster.anyOf( - assertThat(actual >= expected).isTrue(), assertThat(actual < expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractFloatAssert after(float actual, float expected) { - return assertThat(actual).isGreaterThanOrEqualTo(expected); - } - } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java index 59aea8a7568..f46ac40564c 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplates.java @@ -1,15 +1,11 @@ package tech.picnic.errorprone.refastertemplates; -import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.assertj.core.data.Percentage.withPercentage; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; -import com.google.errorprone.refaster.annotation.UseImportPolicy; -import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractIntegerAssert; final class AssertJIntegerTemplates { @@ -28,20 +24,6 @@ AbstractIntegerAssert after(AbstractIntegerAssert intAssert, int n) { } } - static final class AbstractIntegerAssertActualIsEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(int actual, int expected) { - return Refaster.anyOf( - assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractIntegerAssert after(int actual, int expected) { - return assertThat(actual).isEqualTo(expected); - } - } - static final class AbstractIntegerAssertIsNotEqualTo { @BeforeTemplate AbstractIntegerAssert before(AbstractIntegerAssert intAssert, int n) { @@ -55,20 +37,6 @@ AbstractIntegerAssert after(AbstractIntegerAssert intAssert, int n) { } } - static final class AbstractIntegerAssertActualIsNotEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(int actual, int expected) { - return Refaster.anyOf( - assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractIntegerAssert after(int actual, int expected) { - return assertThat(actual).isNotEqualTo(expected); - } - } - static final class AbstractIntegerAssertIsZero { @BeforeTemplate AbstractIntegerAssert before(AbstractIntegerAssert intAssert) { @@ -104,60 +72,4 @@ AbstractIntegerAssert after(AbstractIntegerAssert intAssert) { return intAssert.isEqualTo(1); } } - - static final class AbstractIntegerAssertActualIsLessThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(int actual, int expected) { - return Refaster.anyOf( - assertThat(actual < expected).isTrue(), assertThat(actual >= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractIntegerAssert after(int actual, int expected) { - return assertThat(actual).isLessThan(expected); - } - } - - static final class AbstractIntegerAssertActualIsLessThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(int actual, int expected) { - return Refaster.anyOf( - assertThat(actual <= expected).isTrue(), assertThat(actual > expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractIntegerAssert after(int actual, int expected) { - return assertThat(actual).isLessThanOrEqualTo(expected); - } - } - - static final class AbstractIntegerAssertActualIsGreaterThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(int actual, int expected) { - return Refaster.anyOf( - assertThat(actual > expected).isTrue(), assertThat(actual <= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractIntegerAssert after(int actual, int expected) { - return assertThat(actual).isGreaterThan(expected); - } - } - - static final class AbstractIntegerAssertActualIsGreaterThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(int actual, int expected) { - return Refaster.anyOf( - assertThat(actual >= expected).isTrue(), assertThat(actual < expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractIntegerAssert after(int actual, int expected) { - return assertThat(actual).isGreaterThanOrEqualTo(expected); - } - } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java index 0484ac5faba..e992886dff3 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJLongTemplates.java @@ -1,15 +1,11 @@ package tech.picnic.errorprone.refastertemplates; -import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.assertj.core.data.Percentage.withPercentage; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; -import com.google.errorprone.refaster.annotation.UseImportPolicy; -import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractLongAssert; final class AssertJLongTemplates { @@ -28,20 +24,6 @@ AbstractLongAssert after(AbstractLongAssert longAssert, long n) { } } - static final class AbstractLongAssertActualIsEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(long actual, long expected) { - return Refaster.anyOf( - assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractLongAssert after(long actual, long expected) { - return assertThat(actual).isEqualTo(expected); - } - } - static final class AbstractLongAssertIsNotEqualTo { @BeforeTemplate AbstractLongAssert before(AbstractLongAssert longAssert, long n) { @@ -55,20 +37,6 @@ AbstractLongAssert after(AbstractLongAssert longAssert, long n) { } } - static final class AbstractLongAssertActualIsNotEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(long actual, long expected) { - return Refaster.anyOf( - assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractLongAssert after(long actual, long expected) { - return assertThat(actual).isNotEqualTo(expected); - } - } - static final class AbstractLongAssertIsZero { @BeforeTemplate AbstractLongAssert before(AbstractLongAssert longAssert) { @@ -104,60 +72,4 @@ AbstractLongAssert after(AbstractLongAssert longAssert) { return longAssert.isEqualTo(1); } } - - static final class AbstractLongAssertActualIsLessThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(long actual, long expected) { - return Refaster.anyOf( - assertThat(actual < expected).isTrue(), assertThat(actual >= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractLongAssert after(long actual, long expected) { - return assertThat(actual).isLessThan(expected); - } - } - - static final class AbstractLongAssertActualIsLessThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(long actual, long expected) { - return Refaster.anyOf( - assertThat(actual <= expected).isTrue(), assertThat(actual > expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractLongAssert after(long actual, long expected) { - return assertThat(actual).isLessThanOrEqualTo(expected); - } - } - - static final class AbstractLongAssertActualIsGreaterThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(long actual, long expected) { - return Refaster.anyOf( - assertThat(actual > expected).isTrue(), assertThat(actual <= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractLongAssert after(long actual, long expected) { - return assertThat(actual).isGreaterThan(expected); - } - } - - static final class AbstractLongAssertActualIsGreaterThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(long actual, long expected) { - return Refaster.anyOf( - assertThat(actual >= expected).isTrue(), assertThat(actual < expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractLongAssert after(long actual, long expected) { - return assertThat(actual).isGreaterThanOrEqualTo(expected); - } - } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java index 83b9d482cac..017f897b93e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJShortTemplates.java @@ -1,15 +1,11 @@ package tech.picnic.errorprone.refastertemplates; -import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.assertj.core.data.Percentage.withPercentage; import com.google.errorprone.refaster.Refaster; import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; -import com.google.errorprone.refaster.annotation.UseImportPolicy; -import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractShortAssert; final class AssertJShortTemplates { @@ -28,20 +24,6 @@ AbstractShortAssert after(AbstractShortAssert shortAssert, short n) { } } - static final class AbstractShortAssertActualIsEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(short actual, short expected) { - return Refaster.anyOf( - assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractShortAssert after(short actual, short expected) { - return assertThat(actual).isEqualTo(expected); - } - } - static final class AbstractShortAssertIsNotEqualTo { @BeforeTemplate AbstractShortAssert before(AbstractShortAssert shortAssert, short n) { @@ -56,20 +38,6 @@ AbstractShortAssert after(AbstractShortAssert shortAssert, short n) { } } - static final class AbstractShortAssertActualIsNotEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(short actual, short expected) { - return Refaster.anyOf( - assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractShortAssert after(short actual, short expected) { - return assertThat(actual).isNotEqualTo(expected); - } - } - static final class AbstractShortAssertIsZero { @BeforeTemplate AbstractShortAssert before(AbstractShortAssert shortAssert) { @@ -105,60 +73,4 @@ AbstractShortAssert after(AbstractShortAssert shortAssert) { return shortAssert.isEqualTo((short) 1); } } - - static final class AbstractShortAssertActualIsLessThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(short actual, short expected) { - return Refaster.anyOf( - assertThat(actual < expected).isTrue(), assertThat(actual >= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractShortAssert after(short actual, short expected) { - return assertThat(actual).isLessThan(expected); - } - } - - static final class AbstractShortAssertActualIsLessThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(short actual, short expected) { - return Refaster.anyOf( - assertThat(actual <= expected).isTrue(), assertThat(actual > expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractShortAssert after(short actual, short expected) { - return assertThat(actual).isLessThanOrEqualTo(expected); - } - } - - static final class AbstractShortAssertActualIsGreaterThanExpected { - @BeforeTemplate - AbstractBooleanAssert before(short actual, short expected) { - return Refaster.anyOf( - assertThat(actual > expected).isTrue(), assertThat(actual <= expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractShortAssert after(short actual, short expected) { - return assertThat(actual).isGreaterThan(expected); - } - } - - static final class AbstractShortAssertActualIsGreaterThanOrEqualToExpected { - @BeforeTemplate - AbstractBooleanAssert before(short actual, short expected) { - return Refaster.anyOf( - assertThat(actual >= expected).isTrue(), assertThat(actual < expected).isFalse()); - } - - @AfterTemplate - @UseImportPolicy(STATIC_IMPORT_ALWAYS) - AbstractShortAssert after(short actual, short expected) { - return assertThat(actual).isGreaterThanOrEqualTo(expected); - } - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestInput.java index 0a16ac2179e..f9a7b2607e0 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestInput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractByteAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -21,22 +20,12 @@ ImmutableSet> testAbstractByteAssertIsEqualTo() { assertThat((byte) 0).isCloseTo((byte) 1, withPercentage(0))); } - ImmutableSet> testAbstractByteAssertActualIsEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1 == (byte) 2).isTrue(), assertThat((byte) 1 != (byte) 2).isFalse()); - } - ImmutableSet> testAbstractByteAssertIsNotEqualTo() { return ImmutableSet.of( assertThat((byte) 0).isNotCloseTo((byte) 1, offset((byte) 0)), assertThat((byte) 0).isNotCloseTo((byte) 1, withPercentage(0))); } - ImmutableSet> testAbstractByteAssertActualIsNotEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1 != (byte) 2).isTrue(), assertThat((byte) 1 == (byte) 2).isFalse()); - } - AbstractByteAssert testAbstractByteAssertIsZero() { return assertThat((byte) 0).isZero(); } @@ -48,24 +37,4 @@ AbstractByteAssert testAbstractByteAssertIsNotZero() { AbstractByteAssert testAbstractByteAssertIsOne() { return assertThat((byte) 0).isOne(); } - - ImmutableSet> testAbstractByteAssertActualIsLessThanExpected() { - return ImmutableSet.of( - assertThat((byte) 1 < (byte) 2).isTrue(), assertThat((byte) 1 >= (byte) 2).isFalse()); - } - - ImmutableSet> testAbstractByteAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1 <= (byte) 2).isTrue(), assertThat((byte) 1 > (byte) 2).isFalse()); - } - - ImmutableSet> testAbstractByteAssertActualIsGreaterThanExpected() { - return ImmutableSet.of( - assertThat((byte) 1 > (byte) 2).isTrue(), assertThat((byte) 1 <= (byte) 2).isFalse()); - } - - ImmutableSet> testAbstractByteAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1 >= (byte) 2).isTrue(), assertThat((byte) 1 < (byte) 2).isFalse()); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestOutput.java index 0aec1c12e9d..ea274127a4f 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJByteTemplatesTestOutput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractByteAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -20,21 +19,11 @@ ImmutableSet> testAbstractByteAssertIsEqualTo() { assertThat((byte) 0).isEqualTo((byte) 1), assertThat((byte) 0).isEqualTo((byte) 1)); } - ImmutableSet> testAbstractByteAssertActualIsEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1).isEqualTo((byte) 2), assertThat((byte) 1).isEqualTo((byte) 2)); - } - ImmutableSet> testAbstractByteAssertIsNotEqualTo() { return ImmutableSet.of( assertThat((byte) 0).isNotEqualTo((byte) 1), assertThat((byte) 0).isNotEqualTo((byte) 1)); } - ImmutableSet> testAbstractByteAssertActualIsNotEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1).isNotEqualTo((byte) 2), assertThat((byte) 1).isNotEqualTo((byte) 2)); - } - AbstractByteAssert testAbstractByteAssertIsZero() { return assertThat((byte) 0).isEqualTo((byte) 0); } @@ -46,26 +35,4 @@ AbstractByteAssert testAbstractByteAssertIsNotZero() { AbstractByteAssert testAbstractByteAssertIsOne() { return assertThat((byte) 0).isEqualTo((byte) 1); } - - ImmutableSet> testAbstractByteAssertActualIsLessThanExpected() { - return ImmutableSet.of( - assertThat((byte) 1).isLessThan((byte) 2), assertThat((byte) 1).isLessThan((byte) 2)); - } - - ImmutableSet> testAbstractByteAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1).isLessThanOrEqualTo((byte) 2), - assertThat((byte) 1).isLessThanOrEqualTo((byte) 2)); - } - - ImmutableSet> testAbstractByteAssertActualIsGreaterThanExpected() { - return ImmutableSet.of( - assertThat((byte) 1).isGreaterThan((byte) 2), assertThat((byte) 1).isGreaterThan((byte) 2)); - } - - ImmutableSet> testAbstractByteAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((byte) 1).isGreaterThanOrEqualTo((byte) 2), - assertThat((byte) 1).isGreaterThanOrEqualTo((byte) 2)); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestInput.java index fdbf75a9a0e..2bb51ef4493 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestInput.java @@ -2,35 +2,24 @@ import static org.assertj.core.api.Assertions.assertThat; -import com.google.common.collect.ImmutableSet; import java.math.BigDecimal; import org.assertj.core.api.AbstractAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; final class AssertJComparableTemplatesTest implements RefasterTemplateTestCase { - ImmutableSet> testAbstractComparableAssertActualIsLessThanExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) < 0).isTrue(), - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) >= 0).isFalse()); + AbstractAssert testAbstractComparableAssertActualIsLessThanExpected() { + return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNegative(); } - ImmutableSet> - testAbstractComparableAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) <= 0).isTrue(), - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) > 0).isFalse()); + AbstractAssert testAbstractComparableAssertActualIsLessThanOrEqualToExpected() { + return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNotPositive(); } - ImmutableSet> testAbstractComparableAssertActualIsGreaterThanExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) > 0).isTrue(), - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) <= 0).isFalse()); + AbstractAssert testAbstractComparableAssertActualIsGreaterThanExpected() { + return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isPositive(); } - ImmutableSet> - testAbstractComparableAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) >= 0).isTrue(), - assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE) < 0).isFalse()); + AbstractAssert testAbstractComparableAssertActualIsGreaterThanOrEqualToExpected() { + return assertThat(BigDecimal.ZERO.compareTo(BigDecimal.ONE)).isNotNegative(); } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestOutput.java index 048c0f57f07..85b41a5dee3 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJComparableTemplatesTestOutput.java @@ -2,35 +2,24 @@ import static org.assertj.core.api.Assertions.assertThat; -import com.google.common.collect.ImmutableSet; import java.math.BigDecimal; import org.assertj.core.api.AbstractAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; final class AssertJComparableTemplatesTest implements RefasterTemplateTestCase { - ImmutableSet> testAbstractComparableAssertActualIsLessThanExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO).isLessThan(BigDecimal.ONE), - assertThat(BigDecimal.ZERO).isLessThan(BigDecimal.ONE)); + AbstractAssert testAbstractComparableAssertActualIsLessThanExpected() { + return assertThat(BigDecimal.ZERO).isLessThan(BigDecimal.ONE); } - ImmutableSet> - testAbstractComparableAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO).isLessThanOrEqualTo(BigDecimal.ONE), - assertThat(BigDecimal.ZERO).isLessThanOrEqualTo(BigDecimal.ONE)); + AbstractAssert testAbstractComparableAssertActualIsLessThanOrEqualToExpected() { + return assertThat(BigDecimal.ZERO).isLessThanOrEqualTo(BigDecimal.ONE); } - ImmutableSet> testAbstractComparableAssertActualIsGreaterThanExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO).isGreaterThan(BigDecimal.ONE), - assertThat(BigDecimal.ZERO).isGreaterThan(BigDecimal.ONE)); + AbstractAssert testAbstractComparableAssertActualIsGreaterThanExpected() { + return assertThat(BigDecimal.ZERO).isGreaterThan(BigDecimal.ONE); } - ImmutableSet> - testAbstractComparableAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(BigDecimal.ZERO).isGreaterThanOrEqualTo(BigDecimal.ONE), - assertThat(BigDecimal.ZERO).isGreaterThanOrEqualTo(BigDecimal.ONE)); + AbstractAssert testAbstractComparableAssertActualIsGreaterThanOrEqualToExpected() { + return assertThat(BigDecimal.ZERO).isGreaterThanOrEqualTo(BigDecimal.ONE); } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestInput.java index e1d27310719..54b4fac623d 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestInput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractFloatAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -26,20 +25,12 @@ ImmutableSet> testAbstractFloatAssertIsEqualTo() { assertThat(0F).isCloseTo(1, offset(0F)), assertThat(0F).isCloseTo(1, withPercentage(0))); } - ImmutableSet> testAbstractFloatAssertActualIsEqualToExpected() { - return ImmutableSet.of(assertThat(1F == 2F).isTrue(), assertThat(1F != 2F).isFalse()); - } - ImmutableSet> testAbstractFloatAssertIsNotEqualTo() { return ImmutableSet.of( assertThat(0F).isNotCloseTo(1, offset(0F)), assertThat(0F).isNotCloseTo(1, withPercentage(0))); } - ImmutableSet> testAbstractFloatAssertActualIsNotEqualToExpected() { - return ImmutableSet.of(assertThat(1F != 2F).isTrue(), assertThat(1F == 2F).isFalse()); - } - AbstractFloatAssert testAbstractFloatAssertIsZero() { return assertThat(0F).isZero(); } @@ -51,20 +42,4 @@ AbstractFloatAssert testAbstractFloatAssertIsNotZero() { AbstractFloatAssert testAbstractFloatAssertIsOne() { return assertThat(0F).isOne(); } - - ImmutableSet> testAbstractFloatAssertActualIsLessThanExpected() { - return ImmutableSet.of(assertThat(1F < 2F).isTrue(), assertThat(1F >= 2F).isFalse()); - } - - ImmutableSet> testAbstractFloatAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of(assertThat(1F <= 2F).isTrue(), assertThat(1F > 2F).isFalse()); - } - - ImmutableSet> testAbstractFloatAssertActualIsGreaterThanExpected() { - return ImmutableSet.of(assertThat(1F > 2F).isTrue(), assertThat(1F <= 2F).isFalse()); - } - - ImmutableSet> testAbstractFloatAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of(assertThat(1F >= 2F).isTrue(), assertThat(1F < 2F).isFalse()); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestOutput.java index c1a86f0eb49..40b96263722 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJFloatTemplatesTestOutput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractFloatAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -25,18 +24,10 @@ ImmutableSet> testAbstractFloatAssertIsEqualTo() { return ImmutableSet.of(assertThat(0F).isEqualTo(1), assertThat(0F).isEqualTo(1)); } - ImmutableSet> testAbstractFloatAssertActualIsEqualToExpected() { - return ImmutableSet.of(assertThat(1F).isEqualTo(2F), assertThat(1F).isEqualTo(2F)); - } - ImmutableSet> testAbstractFloatAssertIsNotEqualTo() { return ImmutableSet.of(assertThat(0F).isNotEqualTo(1), assertThat(0F).isNotEqualTo(1)); } - ImmutableSet> testAbstractFloatAssertActualIsNotEqualToExpected() { - return ImmutableSet.of(assertThat(1F).isNotEqualTo(2F), assertThat(1F).isNotEqualTo(2F)); - } - AbstractFloatAssert testAbstractFloatAssertIsZero() { return assertThat(0F).isEqualTo(0); } @@ -48,22 +39,4 @@ AbstractFloatAssert testAbstractFloatAssertIsNotZero() { AbstractFloatAssert testAbstractFloatAssertIsOne() { return assertThat(0F).isEqualTo(1); } - - ImmutableSet> testAbstractFloatAssertActualIsLessThanExpected() { - return ImmutableSet.of(assertThat(1F).isLessThan(2F), assertThat(1F).isLessThan(2F)); - } - - ImmutableSet> testAbstractFloatAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(1F).isLessThanOrEqualTo(2F), assertThat(1F).isLessThanOrEqualTo(2F)); - } - - ImmutableSet> testAbstractFloatAssertActualIsGreaterThanExpected() { - return ImmutableSet.of(assertThat(1F).isGreaterThan(2F), assertThat(1F).isGreaterThan(2F)); - } - - ImmutableSet> testAbstractFloatAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(1F).isGreaterThanOrEqualTo(2F), assertThat(1F).isGreaterThanOrEqualTo(2F)); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestInput.java index 41d8377d762..6b4b7a38c35 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestInput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractIntegerAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -20,19 +19,11 @@ ImmutableSet> testAbstractIntegerAssertIsEqualTo() { assertThat(0).isCloseTo(1, offset(0)), assertThat(0).isCloseTo(1, withPercentage(0))); } - ImmutableSet> testAbstractIntegerAssertActualIsEqualToExpected() { - return ImmutableSet.of(assertThat(1 == 2).isTrue(), assertThat(1 != 2).isFalse()); - } - ImmutableSet> testAbstractIntegerAssertIsNotEqualTo() { return ImmutableSet.of( assertThat(0).isNotCloseTo(1, offset(0)), assertThat(0).isNotCloseTo(1, withPercentage(0))); } - ImmutableSet> testAbstractIntegerAssertActualIsNotEqualToExpected() { - return ImmutableSet.of(assertThat(1 != 2).isTrue(), assertThat(1 == 2).isFalse()); - } - AbstractIntegerAssert testAbstractIntegerAssertIsZero() { return assertThat(0).isZero(); } @@ -44,21 +35,4 @@ AbstractIntegerAssert testAbstractIntegerAssertIsNotZero() { AbstractIntegerAssert testAbstractIntegerAssertIsOne() { return assertThat(0).isOne(); } - - ImmutableSet> testAbstractIntegerAssertActualIsLessThanExpected() { - return ImmutableSet.of(assertThat(1 < 2).isTrue(), assertThat(1 >= 2).isFalse()); - } - - ImmutableSet> testAbstractIntegerAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of(assertThat(1 <= 2).isTrue(), assertThat(1 > 2).isFalse()); - } - - ImmutableSet> testAbstractIntegerAssertActualIsGreaterThanExpected() { - return ImmutableSet.of(assertThat(1 > 2).isTrue(), assertThat(1 <= 2).isFalse()); - } - - ImmutableSet> - testAbstractIntegerAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of(assertThat(1 >= 2).isTrue(), assertThat(1 < 2).isFalse()); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestOutput.java index 62a034a052e..87613912fff 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJIntegerTemplatesTestOutput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractIntegerAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -19,18 +18,10 @@ ImmutableSet> testAbstractIntegerAssertIsEqualTo() { return ImmutableSet.of(assertThat(0).isEqualTo(1), assertThat(0).isEqualTo(1)); } - ImmutableSet> testAbstractIntegerAssertActualIsEqualToExpected() { - return ImmutableSet.of(assertThat(1).isEqualTo(2), assertThat(1).isEqualTo(2)); - } - ImmutableSet> testAbstractIntegerAssertIsNotEqualTo() { return ImmutableSet.of(assertThat(0).isNotEqualTo(1), assertThat(0).isNotEqualTo(1)); } - ImmutableSet> testAbstractIntegerAssertActualIsNotEqualToExpected() { - return ImmutableSet.of(assertThat(1).isNotEqualTo(2), assertThat(1).isNotEqualTo(2)); - } - AbstractIntegerAssert testAbstractIntegerAssertIsZero() { return assertThat(0).isEqualTo(0); } @@ -42,23 +33,4 @@ AbstractIntegerAssert testAbstractIntegerAssertIsNotZero() { AbstractIntegerAssert testAbstractIntegerAssertIsOne() { return assertThat(0).isEqualTo(1); } - - ImmutableSet> testAbstractIntegerAssertActualIsLessThanExpected() { - return ImmutableSet.of(assertThat(1).isLessThan(2), assertThat(1).isLessThan(2)); - } - - ImmutableSet> testAbstractIntegerAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(1).isLessThanOrEqualTo(2), assertThat(1).isLessThanOrEqualTo(2)); - } - - ImmutableSet> testAbstractIntegerAssertActualIsGreaterThanExpected() { - return ImmutableSet.of(assertThat(1).isGreaterThan(2), assertThat(1).isGreaterThan(2)); - } - - ImmutableSet> - testAbstractIntegerAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(1).isGreaterThanOrEqualTo(2), assertThat(1).isGreaterThanOrEqualTo(2)); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestInput.java index 6c9fb992422..b55a52774fc 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestInput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractLongAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -20,20 +19,12 @@ ImmutableSet> testAbstractLongAssertIsEqualTo() { assertThat(0L).isCloseTo(1, offset(0L)), assertThat(0L).isCloseTo(1, withPercentage(0))); } - ImmutableSet> testAbstractLongAssertActualIsEqualToExpected() { - return ImmutableSet.of(assertThat(1L == 2L).isTrue(), assertThat(1L != 2L).isFalse()); - } - ImmutableSet> testAbstractLongAssertIsNotEqualTo() { return ImmutableSet.of( assertThat(0L).isNotCloseTo(1, offset(0L)), assertThat(0L).isNotCloseTo(1, withPercentage(0))); } - ImmutableSet> testAbstractLongAssertActualIsNotEqualToExpected() { - return ImmutableSet.of(assertThat(1L != 2L).isTrue(), assertThat(1L == 2L).isFalse()); - } - AbstractLongAssert testAbstractLongAssertIsZero() { return assertThat(0L).isZero(); } @@ -45,20 +36,4 @@ AbstractLongAssert testAbstractLongAssertIsNotZero() { AbstractLongAssert testAbstractLongAssertIsOne() { return assertThat(0L).isOne(); } - - ImmutableSet> testAbstractLongAssertActualIsLessThanExpected() { - return ImmutableSet.of(assertThat(1L < 2L).isTrue(), assertThat(1L >= 2L).isFalse()); - } - - ImmutableSet> testAbstractLongAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of(assertThat(1L <= 2L).isTrue(), assertThat(1L > 2L).isFalse()); - } - - ImmutableSet> testAbstractLongAssertActualIsGreaterThanExpected() { - return ImmutableSet.of(assertThat(1L > 2L).isTrue(), assertThat(1L <= 2L).isFalse()); - } - - ImmutableSet> testAbstractLongAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of(assertThat(1L >= 2L).isTrue(), assertThat(1L < 2L).isFalse()); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestOutput.java index b8948febb0e..1c7a851983d 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJLongTemplatesTestOutput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractLongAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -19,18 +18,10 @@ ImmutableSet> testAbstractLongAssertIsEqualTo() { return ImmutableSet.of(assertThat(0L).isEqualTo(1), assertThat(0L).isEqualTo(1)); } - ImmutableSet> testAbstractLongAssertActualIsEqualToExpected() { - return ImmutableSet.of(assertThat(1L).isEqualTo(2L), assertThat(1L).isEqualTo(2L)); - } - ImmutableSet> testAbstractLongAssertIsNotEqualTo() { return ImmutableSet.of(assertThat(0L).isNotEqualTo(1), assertThat(0L).isNotEqualTo(1)); } - ImmutableSet> testAbstractLongAssertActualIsNotEqualToExpected() { - return ImmutableSet.of(assertThat(1L).isNotEqualTo(2L), assertThat(1L).isNotEqualTo(2L)); - } - AbstractLongAssert testAbstractLongAssertIsZero() { return assertThat(0L).isEqualTo(0); } @@ -42,22 +33,4 @@ AbstractLongAssert testAbstractLongAssertIsNotZero() { AbstractLongAssert testAbstractLongAssertIsOne() { return assertThat(0L).isEqualTo(1); } - - ImmutableSet> testAbstractLongAssertActualIsLessThanExpected() { - return ImmutableSet.of(assertThat(1L).isLessThan(2L), assertThat(1L).isLessThan(2L)); - } - - ImmutableSet> testAbstractLongAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(1L).isLessThanOrEqualTo(2L), assertThat(1L).isLessThanOrEqualTo(2L)); - } - - ImmutableSet> testAbstractLongAssertActualIsGreaterThanExpected() { - return ImmutableSet.of(assertThat(1L).isGreaterThan(2L), assertThat(1L).isGreaterThan(2L)); - } - - ImmutableSet> testAbstractLongAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat(1L).isGreaterThanOrEqualTo(2L), assertThat(1L).isGreaterThanOrEqualTo(2L)); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestInput.java index 1006be9ddb0..e4fc7393733 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestInput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractShortAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -21,22 +20,12 @@ ImmutableSet> testAbstractShortAssertIsEqualTo() { assertThat((short) 0).isCloseTo((short) 1, withPercentage(0))); } - ImmutableSet> testAbstractShortAssertActualIsEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1 == (short) 2).isTrue(), assertThat((short) 1 != (short) 2).isFalse()); - } - ImmutableSet> testAbstractShortAssertIsNotEqualTo() { return ImmutableSet.of( assertThat((short) 0).isNotCloseTo((short) 1, offset((short) 0)), assertThat((short) 0).isNotCloseTo((short) 1, withPercentage(0))); } - ImmutableSet> testAbstractShortAssertActualIsNotEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1 != (short) 2).isTrue(), assertThat((short) 1 == (short) 2).isFalse()); - } - AbstractShortAssert testAbstractShortAssertIsZero() { return assertThat((short) 0).isZero(); } @@ -48,24 +37,4 @@ AbstractShortAssert testAbstractShortAssertIsNotZero() { AbstractShortAssert testAbstractShortAssertIsOne() { return assertThat((short) 0).isOne(); } - - ImmutableSet> testAbstractShortAssertActualIsLessThanExpected() { - return ImmutableSet.of( - assertThat((short) 1 < (short) 2).isTrue(), assertThat((short) 1 >= (short) 2).isFalse()); - } - - ImmutableSet> testAbstractShortAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1 <= (short) 2).isTrue(), assertThat((short) 1 > (short) 2).isFalse()); - } - - ImmutableSet> testAbstractShortAssertActualIsGreaterThanExpected() { - return ImmutableSet.of( - assertThat((short) 1 > (short) 2).isTrue(), assertThat((short) 1 <= (short) 2).isFalse()); - } - - ImmutableSet> testAbstractShortAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1 >= (short) 2).isTrue(), assertThat((short) 1 < (short) 2).isFalse()); - } } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestOutput.java index 2552312b45f..58beb71e241 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refastertemplates/AssertJShortTemplatesTestOutput.java @@ -5,7 +5,6 @@ import static org.assertj.core.data.Percentage.withPercentage; import com.google.common.collect.ImmutableSet; -import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractShortAssert; import tech.picnic.errorprone.refaster.test.RefasterTemplateTestCase; @@ -20,23 +19,12 @@ ImmutableSet> testAbstractShortAssertIsEqualTo() { assertThat((short) 0).isEqualTo((short) 1), assertThat((short) 0).isEqualTo((short) 1)); } - ImmutableSet> testAbstractShortAssertActualIsEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1).isEqualTo((short) 2), assertThat((short) 1).isEqualTo((short) 2)); - } - ImmutableSet> testAbstractShortAssertIsNotEqualTo() { return ImmutableSet.of( assertThat((short) 0).isNotEqualTo((short) 1), assertThat((short) 0).isNotEqualTo((short) 1)); } - ImmutableSet> testAbstractShortAssertActualIsNotEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1).isNotEqualTo((short) 2), - assertThat((short) 1).isNotEqualTo((short) 2)); - } - AbstractShortAssert testAbstractShortAssertIsZero() { return assertThat((short) 0).isEqualTo((short) 0); } @@ -48,27 +36,4 @@ AbstractShortAssert testAbstractShortAssertIsNotZero() { AbstractShortAssert testAbstractShortAssertIsOne() { return assertThat((short) 0).isEqualTo((short) 1); } - - ImmutableSet> testAbstractShortAssertActualIsLessThanExpected() { - return ImmutableSet.of( - assertThat((short) 1).isLessThan((short) 2), assertThat((short) 1).isLessThan((short) 2)); - } - - ImmutableSet> testAbstractShortAssertActualIsLessThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1).isLessThanOrEqualTo((short) 2), - assertThat((short) 1).isLessThanOrEqualTo((short) 2)); - } - - ImmutableSet> testAbstractShortAssertActualIsGreaterThanExpected() { - return ImmutableSet.of( - assertThat((short) 1).isGreaterThan((short) 2), - assertThat((short) 1).isGreaterThan((short) 2)); - } - - ImmutableSet> testAbstractShortAssertActualIsGreaterThanOrEqualToExpected() { - return ImmutableSet.of( - assertThat((short) 1).isGreaterThanOrEqualTo((short) 2), - assertThat((short) 1).isGreaterThanOrEqualTo((short) 2)); - } }