Skip to content

Commit 20dc7af

Browse files
committed
Update test file for #1654
1 parent be36a06 commit 20dc7af

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

src/test/java/tools/jackson/databind/jsontype/NoTypeInfo1654Test.java

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import com.fasterxml.jackson.annotation.JsonTypeInfo;
88

9+
import tools.jackson.core.JacksonException;
910
import tools.jackson.core.JsonParser;
1011
import tools.jackson.databind.*;
1112
import tools.jackson.databind.annotation.JsonDeserialize;
@@ -49,7 +50,19 @@ public Value1654UntypedContainer(Value1654... v) {
4950
}
5051
}
5152

52-
/*
53+
static class Value1654UsingDeserializerUntypedContainer {
54+
@JsonDeserialize(contentUsing = Value1654Deserializer.class)
55+
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE)
56+
public List<Value1654> values;
57+
58+
protected Value1654UsingDeserializerUntypedContainer() {
59+
}
60+
61+
public Value1654UsingDeserializerUntypedContainer(Value1654... v) {
62+
values = Arrays.asList(v);
63+
}
64+
}
65+
5366
static class Value1654Deserializer extends ValueDeserializer<Value1654> {
5467
@Override
5568
public Value1654 deserialize(JsonParser p, DeserializationContext ctxt) {
@@ -58,7 +71,7 @@ public Value1654 deserialize(JsonParser p, DeserializationContext ctxt) {
5871
return new Value1654(13);
5972
}
6073
}
61-
*/
74+
6275

6376
private final ObjectMapper MAPPER = newJsonMapper();
6477

@@ -92,7 +105,7 @@ void withNoTypeInfoOverrideSer() throws Exception {
92105

93106
// [databind#1654]
94107
@Test
95-
void withNoTypeInfoOverrideDeser() throws Exception {
108+
void withNoTypeInfoDeser() throws Exception {
96109
// and then actual failing case
97110
final String noTypeJson = a2q(
98111
"{'values':[{'x':3},{'x':7}]}"
@@ -101,4 +114,17 @@ void withNoTypeInfoOverrideDeser() throws Exception {
101114
assertEquals(2, unResult.values.size());
102115
assertEquals(7, unResult.values.get(1).x);
103116
}
117+
118+
// [databind#1654]
119+
@Test
120+
void withNoTypeInfoOverrideDeser() throws Exception {
121+
// and then actual failing case
122+
final String noTypeJson = a2q(
123+
"{'values':[{'x':3},{'x':7}]}"
124+
);
125+
Value1654UsingDeserializerUntypedContainer unResult = MAPPER.readValue(noTypeJson, Value1654UsingDeserializerUntypedContainer.class);
126+
assertEquals(2, unResult.values.size());
127+
assertEquals(13, unResult.values.get(0).x);
128+
assertEquals(13, unResult.values.get(1).x);
129+
}
104130
}

0 commit comments

Comments
 (0)