Skip to content

Commit

Permalink
improving #113 test
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 13, 2013
1 parent cb56363 commit c6c0005
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/test/java/com/fasterxml/jackson/failing/TestIssueGH113.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public static abstract class Animal {
public final static String ID = "id";

private String id;
public Animal() {
}

@JsonCreator
public Animal(@JsonProperty(ID) String id) {
Expand All @@ -29,10 +27,6 @@ public String getId() {

@JsonIgnoreProperties(ignoreUnknown = true)
public static class Dog extends Animal {
public Dog() {
super();
}

@JsonCreator
public Dog(@JsonProperty(ID) String id) {
super(id);
Expand All @@ -56,10 +50,10 @@ public Animal getAnimal() {
public void testSubtypes() throws Exception
{
ObjectMapper mapper = new ObjectMapper();

String id = "nice dogy";
String serializedDog = mapper.writeValueAsString(new AnimalWrapper(new Dog(id)));
AnimalWrapper wrapper = mapper.readValue(serializedDog, AnimalWrapper.class);
String json = mapper.writeValueAsString(new AnimalWrapper(new Dog(id)));
//System.err.println("JSON = "+json);
AnimalWrapper wrapper = mapper.readValue(json, AnimalWrapper.class);
assertEquals(id, wrapper.getAnimal().getId());
}
}

0 comments on commit c6c0005

Please sign in to comment.