Skip to content

Commit 7695eb5

Browse files
committed
Move test for #3220 under failing to prevent CI build failure
1 parent 884efab commit 7695eb5

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/MixingFactoryMethodTest.java renamed to src/test/java/com/fasterxml/jackson/failing/MixinForFactoryMethod3220Test.java

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
package com.fasterxml.jackson.databind.deser;
1+
package com.fasterxml.jackson.failing;
22

3-
import com.fasterxml.jackson.annotation.JsonCreator;
4-
import com.fasterxml.jackson.annotation.JsonGetter;
5-
import com.fasterxml.jackson.annotation.JsonProperty;
6-
import com.fasterxml.jackson.core.JsonProcessingException;
7-
import com.fasterxml.jackson.databind.ObjectMapper;
83
import java.util.Objects;
9-
import org.junit.Test;
104

11-
import static org.junit.Assert.assertEquals;
5+
import com.fasterxml.jackson.annotation.*;
6+
7+
import com.fasterxml.jackson.databind.BaseMapTest;
8+
import com.fasterxml.jackson.databind.ObjectMapper;
9+
import com.fasterxml.jackson.databind.json.JsonMapper;
1210

13-
public class MixingFactoryMethodTest {
14-
public static class Timestamped<T> {
11+
public class MixinForFactoryMethod3220Test
12+
extends BaseMapTest
13+
{
14+
// [databind#3220]
15+
static class Timestamped<T> {
1516
private final T value;
1617
private final int timestamp;
1718

18-
private Timestamped(T value, int timestamp) {
19+
Timestamped(T value, int timestamp) {
1920
this.value = value;
2021
this.timestamp = timestamp;
2122
}
@@ -46,12 +47,11 @@ public int hashCode() {
4647
}
4748
}
4849

49-
public abstract static class TimestampedMixin<T> {
50+
abstract static class TimestampedMixin<T> {
5051
@JsonCreator
5152
public static <T> void stamp(
5253
@JsonProperty("value") T value,
53-
@JsonProperty("timestamp") int timestamp
54-
) {
54+
@JsonProperty("timestamp") int timestamp) {
5555
}
5656

5757
@JsonGetter("value")
@@ -61,16 +61,13 @@ public static <T> void stamp(
6161
abstract int getTimestamp();
6262
}
6363

64-
public static class Profile {
64+
static class Profile {
6565
private final String firstName;
6666
private final String lastName;
6767

6868
@JsonCreator
69-
public Profile(
70-
@JsonProperty("firstName")
71-
String firstName,
72-
@JsonProperty("lastName")
73-
String lastName
69+
public Profile(@JsonProperty("firstName") String firstName,
70+
@JsonProperty("lastName") String lastName
7471
) {
7572
this.firstName = firstName;
7673
this.lastName = lastName;
@@ -100,14 +97,11 @@ public int hashCode() {
10097
}
10198
}
10299

103-
public static class User {
100+
static class User {
104101
private final Timestamped<Profile> profile;
105102

106103
@JsonCreator
107-
private User(
108-
@JsonProperty("profile")
109-
Timestamped<Profile> profile
110-
) {
104+
User(@JsonProperty("profile") Timestamped<Profile> profile) {
111105
this.profile = profile;
112106
}
113107

@@ -130,10 +124,12 @@ public int hashCode() {
130124
}
131125
}
132126

133-
@Test
134-
public void testMixin() throws JsonProcessingException {
135-
ObjectMapper mapper = new ObjectMapper();
136-
mapper.addMixIn(Timestamped.class, TimestampedMixin.class);
127+
// [databind#3220]
128+
public void testMixin() throws Exception
129+
{
130+
ObjectMapper mapper = JsonMapper.builder()
131+
.addMixIn(Timestamped.class, TimestampedMixin.class)
132+
.build();
137133

138134
Profile profile = new Profile("Jackson", "Databind");
139135
User user = new User(new Timestamped<>(profile, 1));
@@ -144,7 +140,6 @@ public void testMixin() throws JsonProcessingException {
144140
);
145141

146142
Profile deserializedProfile = deserializedUser.getProfile().getValue();
147-
148143
assertEquals(profile, deserializedProfile);
149144
assertEquals(user, deserializedUser);
150145
}

0 commit comments

Comments
 (0)