Skip to content

Commit 6d54a4b

Browse files
committed
Merge branch '2.17' into 2.18
2 parents fd80718 + 526f11d commit 6d54a4b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import java.util.List;
4+
5+
import org.junit.jupiter.api.Assertions;
6+
import org.junit.jupiter.api.Test;
7+
8+
import com.fasterxml.jackson.annotation.*;
9+
10+
import com.fasterxml.jackson.databind.ObjectMapper;
11+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
12+
13+
public class ObjectIdSubTypes4607Test extends DatabindTestUtil
14+
{
15+
@JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class)
16+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
17+
@JsonSubTypes({
18+
@JsonSubTypes.Type(value = EnumTypeDefinition.class, name = "enum"),
19+
@JsonSubTypes.Type(value = NumberTypeDefinition.class, name = "number")
20+
})
21+
interface TypeDefinition {
22+
}
23+
24+
static class EnumTypeDefinition implements TypeDefinition {
25+
public List<String> values;
26+
}
27+
28+
static class NumberTypeDefinition implements TypeDefinition {
29+
}
30+
31+
@Test
32+
public void shouldHandleTypeDefinitionJson() throws Exception {
33+
final ObjectMapper mapper = newJsonMapper();
34+
TypeDefinition model = mapper.readValue("{ \"@type\": \"number\" }", TypeDefinition.class);
35+
Assertions.assertInstanceOf(NumberTypeDefinition.class, model);
36+
}
37+
}
38+

0 commit comments

Comments
 (0)