Skip to content

Commit

Permalink
Try to reproduce #691, no luck yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 6, 2015
1 parent 4a9919c commit 14d979d
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
Expand Down Expand Up @@ -117,6 +120,11 @@ public NoEmptyStringsMap add(String key, String value) {
}
}

// for [databind#691]
@JsonTypeInfo(use=Id.NAME)
@JsonTypeName("mymap")
static class MapWithTypedValues extends LinkedHashMap<String,String> { }

/*
/**********************************************************
/* Test methods
Expand Down Expand Up @@ -255,4 +263,17 @@ public void testClassKey() throws IOException
String json = MAPPER.writeValueAsString(map);
assertEquals(aposToQuotes("{'java.lang.String':2}"), json);
}

// [databind#691]
public void testNullJsonMapping691() throws Exception
{
MapWithTypedValues input = new MapWithTypedValues();
input.put("id", "Test");
input.put("NULL", null);

String json = MAPPER.writeValueAsString(input);

assertEquals(aposToQuotes("{'@type':'mymap','id':'Test','NULL':null}"),
json);
}
}

0 comments on commit 14d979d

Please sign in to comment.