/
TestLocalType609.java
36 lines (27 loc) · 1011 Bytes
/
TestLocalType609.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.fasterxml.jackson.databind.type;
import com.fasterxml.jackson.databind.*;
/**
* Failing test related to [databind#609]
*/
public class TestLocalType609 extends BaseMapTest
{
static class EntityContainer {
RuleForm entity;
@SuppressWarnings("unchecked")
public <T extends RuleForm> T getEntity() { return (T) entity; }
public <T extends RuleForm> void setEntity(T e) { entity = e; }
}
static class RuleForm {
public int value;
public RuleForm() { }
public RuleForm(int v) { value = v; }
}
public void testLocalPartialType609() throws Exception {
ObjectMapper mapper = new ObjectMapper();
EntityContainer input = new EntityContainer();
input.entity = new RuleForm(12);
String json = mapper.writeValueAsString(input);
EntityContainer output = mapper.readValue(json, EntityContainer.class);
assertEquals(12, output.getEntity().value);
}
}