Skip to content

Commit e6567b6

Browse files
mandreanrzwitserloot
authored andcommitted
test: Add Jackson 3 test cases and version ambiguity warnings
Add JacksonizedAccessorsJackson3 test case verifying that @Jacksonized with jacksonVersion=3 emits the correct annotations. Add expected warning messages for tests that have both Jackson 2 and 3 on the classpath without explicit version configuration, and fix JacksonizedSuperBuilderWithJsonDeserialize message expectations.
1 parent 45e72e2 commit e6567b6

8 files changed

Lines changed: 192 additions & 0 deletions
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
//version 8: Jackson deps are at least Java7+.
2+
//CONF: lombok.jacksonized.jacksonVersion += 3
3+
class JacksonizedAccessorsJackson3 {
4+
@com.fasterxml.jackson.annotation.JsonProperty("name")
5+
private String name;
6+
@com.fasterxml.jackson.annotation.JsonProperty("age")
7+
private int age;
8+
@com.fasterxml.jackson.annotation.JsonIgnore
9+
private transient String password;
10+
11+
@java.lang.SuppressWarnings("all")
12+
@lombok.Generated
13+
public JacksonizedAccessorsJackson3() {
14+
}
15+
16+
@com.fasterxml.jackson.annotation.JsonProperty("name")
17+
@java.lang.SuppressWarnings("all")
18+
@lombok.Generated
19+
public String name() {
20+
return this.name;
21+
}
22+
23+
@com.fasterxml.jackson.annotation.JsonProperty("age")
24+
@java.lang.SuppressWarnings("all")
25+
@lombok.Generated
26+
public int age() {
27+
return this.age;
28+
}
29+
30+
@com.fasterxml.jackson.annotation.JsonIgnore
31+
@java.lang.SuppressWarnings("all")
32+
@lombok.Generated
33+
public String password() {
34+
return this.password;
35+
}
36+
37+
/**
38+
* @return {@code this}.
39+
*/
40+
@com.fasterxml.jackson.annotation.JsonProperty("name")
41+
@java.lang.SuppressWarnings("all")
42+
@lombok.Generated
43+
public JacksonizedAccessorsJackson3 name(final String name) {
44+
this.name = name;
45+
return this;
46+
}
47+
48+
/**
49+
* @return {@code this}.
50+
*/
51+
@com.fasterxml.jackson.annotation.JsonProperty("age")
52+
@java.lang.SuppressWarnings("all")
53+
@lombok.Generated
54+
public JacksonizedAccessorsJackson3 age(final int age) {
55+
this.age = age;
56+
return this;
57+
}
58+
59+
/**
60+
* @return {@code this}.
61+
*/
62+
@com.fasterxml.jackson.annotation.JsonIgnore
63+
@java.lang.SuppressWarnings("all")
64+
@lombok.Generated
65+
public JacksonizedAccessorsJackson3 password(final String password) {
66+
this.password = password;
67+
return this;
68+
}
69+
70+
@java.lang.Override
71+
@java.lang.SuppressWarnings("all")
72+
@lombok.Generated
73+
public boolean equals(final java.lang.Object o) {
74+
if (o == this) return true;
75+
if (!(o instanceof JacksonizedAccessorsJackson3)) return false;
76+
final JacksonizedAccessorsJackson3 other = (JacksonizedAccessorsJackson3) o;
77+
if (!other.canEqual((java.lang.Object) this)) return false;
78+
if (this.age() != other.age()) return false;
79+
final java.lang.Object this$name = this.name();
80+
final java.lang.Object other$name = other.name();
81+
if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
82+
return true;
83+
}
84+
85+
@java.lang.SuppressWarnings("all")
86+
@lombok.Generated
87+
protected boolean canEqual(final java.lang.Object other) {
88+
return other instanceof JacksonizedAccessorsJackson3;
89+
}
90+
91+
@java.lang.Override
92+
@java.lang.SuppressWarnings("all")
93+
@lombok.Generated
94+
public int hashCode() {
95+
final int PRIME = 59;
96+
int result = 1;
97+
result = result * PRIME + this.age();
98+
final java.lang.Object $name = this.name();
99+
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
100+
return result;
101+
}
102+
103+
@java.lang.Override
104+
@java.lang.SuppressWarnings("all")
105+
@lombok.Generated
106+
public java.lang.String toString() {
107+
return "JacksonizedAccessorsJackson3(name=" + this.name() + ", age=" + this.age() + ", password=" + this.password() + ")";
108+
}
109+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
@lombok.Data @lombok.experimental.Accessors(fluent = true) @lombok.extern.jackson.Jacksonized class JacksonizedAccessorsJackson3 {
2+
private @com.fasterxml.jackson.annotation.JsonProperty("name") String name;
3+
private @com.fasterxml.jackson.annotation.JsonProperty("age") int age;
4+
private transient @com.fasterxml.jackson.annotation.JsonIgnore String password;
5+
public @com.fasterxml.jackson.annotation.JsonProperty("name") @java.lang.SuppressWarnings("all") @lombok.Generated String name() {
6+
return this.name;
7+
}
8+
public @com.fasterxml.jackson.annotation.JsonProperty("age") @java.lang.SuppressWarnings("all") @lombok.Generated int age() {
9+
return this.age;
10+
}
11+
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated String password() {
12+
return this.password;
13+
}
14+
/**
15+
* @return {@code this}.
16+
*/
17+
public @com.fasterxml.jackson.annotation.JsonProperty("name") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 name(final String name) {
18+
this.name = name;
19+
return this;
20+
}
21+
/**
22+
* @return {@code this}.
23+
*/
24+
public @com.fasterxml.jackson.annotation.JsonProperty("age") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 age(final int age) {
25+
this.age = age;
26+
return this;
27+
}
28+
/**
29+
* @return {@code this}.
30+
*/
31+
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 password(final String password) {
32+
this.password = password;
33+
return this;
34+
}
35+
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated boolean equals(final java.lang.Object o) {
36+
if ((o == this))
37+
return true;
38+
if ((! (o instanceof JacksonizedAccessorsJackson3)))
39+
return false;
40+
final JacksonizedAccessorsJackson3 other = (JacksonizedAccessorsJackson3) o;
41+
if ((! other.canEqual((java.lang.Object) this)))
42+
return false;
43+
if ((this.age() != other.age()))
44+
return false;
45+
final java.lang.Object this$name = this.name();
46+
final java.lang.Object other$name = other.name();
47+
if (((this$name == null) ? (other$name != null) : (! this$name.equals(other$name))))
48+
return false;
49+
return true;
50+
}
51+
protected @java.lang.SuppressWarnings("all") @lombok.Generated boolean canEqual(final java.lang.Object other) {
52+
return (other instanceof JacksonizedAccessorsJackson3);
53+
}
54+
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated int hashCode() {
55+
final int PRIME = 59;
56+
int result = 1;
57+
result = ((result * PRIME) + this.age());
58+
final java.lang.Object $name = this.name();
59+
result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode()));
60+
return result;
61+
}
62+
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated java.lang.String toString() {
63+
return (((((("JacksonizedAccessorsJackson3(name=" + this.name()) + ", age=") + this.age()) + ", password=") + this.password()) + ")");
64+
}
65+
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3() {
66+
super();
67+
}
68+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//version 8: Jackson deps are at least Java7+.
2+
//CONF: lombok.jacksonized.jacksonVersion += 3
3+
@lombok.Data
4+
@lombok.experimental.Accessors(fluent = true)
5+
@lombok.extern.jackson.Jacksonized
6+
class JacksonizedAccessorsJackson3 {
7+
private String name;
8+
private int age;
9+
private transient String password;
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
2 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
12
2 @JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.

0 commit comments

Comments
 (0)