diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java index d04322990b..542f8a3507 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java @@ -9,7 +9,6 @@ import org.w3c.dom.Element; import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.CharacterEscapes; import com.fasterxml.jackson.databind.*; @@ -191,7 +190,8 @@ public String getId() { } } - @JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS, include = As.PROPERTY, property = "@class") + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") + @JsonSubTypes({ @JsonSubTypes.Type(name = "Foo", value = Foo.class) }) interface Strategy { } static class Foo implements Strategy { @@ -310,24 +310,18 @@ public void testWithCustomElements() throws Exception } // [databind#2475] - public void testIssue2475Filter() throws Exception { + public void testIssue2475() throws Exception { SimpleFilterProvider provider = new SimpleFilterProvider().addFilter("myFilter", new MyFilter2475()); ObjectWriter writer = MAPPER.writer(provider); - writer.writeValueAsString(new Item2475(new ArrayList(), "ID-1")); - } - - // [databind#2475] - public void testIssue2475Contents() throws Exception { - SimpleFilterProvider provider = new SimpleFilterProvider().addFilter("myFilter", new SimpleBeanPropertyFilter() {}); - ObjectWriter writer = MAPPER.writer(provider); - - assertEquals(aposToQuotes("{'id':'ID-1','strategy':{'foo':42},'set':[]}"), + // contents don't really matter that much as verification within filter but... let's + // check anyway + assertEquals(aposToQuotes("{'id':'ID-1','strategy':{'type':'Foo','foo':42},'set':[]}"), writer.writeValueAsString(new Item2475(new ArrayList(), "ID-1"))); - assertEquals(aposToQuotes("{'id':'ID-2','strategy':{'foo':42},'set':[]}"), + assertEquals(aposToQuotes("{'id':'ID-2','strategy':{'type':'Foo','foo':42},'set':[]}"), writer.writeValueAsString(new Item2475(new HashSet(), "ID-2"))); - } - + + } }