Skip to content

Commit 1b83366

Browse files
committed
Merge pull request #807 from christophercurrie/inner-class-reader
readerForUpdating should support inner classes regardless of annotations
2 parents 72740cd + b9c831a commit 1b83366

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.fasterxml.jackson.databind.BaseMapTest;
5+
6+
import java.io.IOException;
7+
8+
public class TestInnerClassReaderFor extends BaseMapTest {
9+
10+
class X {
11+
private String value;
12+
13+
X(String value) {
14+
this.value = value;
15+
}
16+
17+
public String getValue() {
18+
return value;
19+
}
20+
21+
public void setValue(String value) {
22+
this.value = value;
23+
}
24+
}
25+
26+
class Y extends X {
27+
Y(@JsonProperty("value") String value) {
28+
super(value);
29+
}
30+
}
31+
32+
public void testReaderFor() throws IOException {
33+
34+
X x = new X("dummy");
35+
objectMapper().readerForUpdating(x).readValue("{\"value\": \"updatedX\"}");
36+
assertEquals(x.getValue(), "updatedX");
37+
38+
Y y = new Y("dummy");
39+
objectMapper().readerForUpdating(y).readValue("{\"value\": \"updatedY\"}");
40+
assertEquals(y.getValue(), "updatedY");
41+
42+
}
43+
44+
}

0 commit comments

Comments
 (0)