Skip to content

Commit bd0732c

Browse files
committed
Move failing #2016 under failing, needs more tests, work
1 parent 90337ec commit bd0732c

File tree

2 files changed

+55
-24
lines changed

2 files changed

+55
-24
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsDelegating.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.fasterxml.jackson.core.JsonToken;
1010

1111
import com.fasterxml.jackson.databind.*;
12-
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
1312
import com.fasterxml.jackson.databind.util.TokenBuffer;
1413

1514
public class TestCreatorsDelegating extends BaseMapTest
@@ -83,20 +82,6 @@ public MapBean(Map<String, Long> map) {
8382
}
8483
}
8584

86-
// [databind#2016]
87-
static class Wrapper2016 {
88-
private final List<String> value;
89-
90-
@JsonCreator //(mode = JsonCreator.Mode.DELEGATING)
91-
public Wrapper2016(@JsonDeserialize(as = LinkedList.class) List<String> value) {
92-
this.value = value;
93-
}
94-
95-
public List<String> getValue() {
96-
return value;
97-
}
98-
}
99-
10085
/*
10186
/**********************************************************
10287
/* Test methods
@@ -194,13 +179,4 @@ public void testIssue465() throws Exception
194179
bean = MAPPER.readValue(EMPTY_JSON, MapBean.class);
195180
assertEquals(0, bean.map.size());
196181
}
197-
198-
// [databind#2016]
199-
public void testCreatorWithDeserializeAs2016() throws Exception
200-
{
201-
String json = "[\"Hello, World!\"]";
202-
Wrapper2016 actual = MAPPER.readValue(json, Wrapper2016.class);
203-
assertEquals(Collections.singletonList("Hello, World!"), actual.getValue());
204-
assertEquals(LinkedList.class, actual.getValue().getClass());
205-
}
206182
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import java.util.*;
4+
5+
import com.fasterxml.jackson.annotation.JsonCreator;
6+
import com.fasterxml.jackson.databind.BaseMapTest;
7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
9+
10+
// Tests for problems uncovered with [databind#2016]; related to
11+
// `@JsonDeserialize` modifications to type, deserializer(s)
12+
public class DelegatingCreatorAnnotations2016Test extends BaseMapTest
13+
{
14+
// [databind#2016]
15+
static class Wrapper2016As {
16+
Object value;
17+
18+
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
19+
public Wrapper2016As(@JsonDeserialize(as = java.util.Date.class) Object v) {
20+
value = v;
21+
}
22+
}
23+
24+
static class Wrapper2016ContentAs {
25+
List<Object> value;
26+
27+
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
28+
public Wrapper2016ContentAs(@JsonDeserialize(contentAs = java.util.Date.class) List<Object> v) {
29+
value = v;
30+
}
31+
}
32+
33+
/*
34+
/**********************************************************************
35+
/* Test methods
36+
/**********************************************************************
37+
*/
38+
39+
private final ObjectMapper MAPPER = newObjectMapper();
40+
41+
// [databind#2016]
42+
public void testDelegatingWithAs() throws Exception
43+
{
44+
Wrapper2016As actual = MAPPER.readValue("123", Wrapper2016As.class);
45+
assertEquals(Date.class, actual.value.getClass());
46+
}
47+
48+
public void testDelegatingWithContentAs() throws Exception
49+
{
50+
Wrapper2016ContentAs actual = MAPPER.readValue("[123]", Wrapper2016ContentAs.class);
51+
List<Object> l = actual.value;
52+
assertEquals(1, l.size());
53+
assertEquals(Date.class, l.get(0).getClass());
54+
}
55+
}

0 commit comments

Comments
 (0)