From 30cfbcf9e42f9f997817ad0d097b71655f9a8485 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 26 Oct 2015 22:21:16 +0100 Subject: Add tests for `@EqualsAndHashCode` for the attributes `of` and `exclude` --- .../after-delombok/EqualsAndHashcodeOfExclude.java | 46 ++++++++++++++++++++++ .../after-ecj/EqualsAndHashcodeOfExclude.java | 46 ++++++++++++++++++++++ .../before/EqualsAndHashCodeOfExclude.java | 11 ++++++ 3 files changed, 103 insertions(+) create mode 100644 test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java create mode 100644 test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java create mode 100644 test/transform/resource/before/EqualsAndHashCodeOfExclude.java (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java b/test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java new file mode 100644 index 00000000..ae7b8451 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java @@ -0,0 +1,46 @@ +final class EqualsAndHashCodeOf { + int x; + int y; + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCodeOf)) return false; + final EqualsAndHashCodeOf other = (EqualsAndHashCodeOf)o; + if (this.x != other.x) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.x; + return result; + } +} +final class EqualsAndHashCodeExclude { + int x; + int y; + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCodeExclude)) return false; + final EqualsAndHashCodeExclude other = (EqualsAndHashCodeExclude)o; + if (this.x != other.x) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.x; + return result; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java b/test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java new file mode 100644 index 00000000..283c5430 --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java @@ -0,0 +1,46 @@ +final @lombok.EqualsAndHashCode(of = {"x"}) class EqualsAndHashCodeOf { + int x; + int y; + EqualsAndHashCodeOf() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCodeOf))) + return false; + final EqualsAndHashCodeOf other = (EqualsAndHashCodeOf) o; + if ((this.x != other.x)) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.x); + return result; + } +} +final @lombok.EqualsAndHashCode(exclude = {"y"}) class EqualsAndHashCodeExclude { + int x; + int y; + EqualsAndHashCodeExclude() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCodeExclude))) + return false; + final EqualsAndHashCodeExclude other = (EqualsAndHashCodeExclude) o; + if ((this.x != other.x)) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.x); + return result; + } +} \ No newline at end of file diff --git a/test/transform/resource/before/EqualsAndHashCodeOfExclude.java b/test/transform/resource/before/EqualsAndHashCodeOfExclude.java new file mode 100644 index 00000000..0625ba52 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeOfExclude.java @@ -0,0 +1,11 @@ +@lombok.EqualsAndHashCode(of={"x"}) +final class EqualsAndHashCodeOf { + int x; + int y; +} + +@lombok.EqualsAndHashCode(exclude={"y"}) +final class EqualsAndHashCodeExclude { + int x; + int y; +} \ No newline at end of file -- cgit