forked from spotify/ffwd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[json] regression test for null value
A JSON null value is being translated to a “null” string. Was supposed to be fixed in FasterXML/jackson-databind#1842 but it doesn’t appear to be.
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
modules/json/src/test/java/com/spotify/ffwd/json/JsonObjectMapperDecoderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.spotify.ffwd.json; | ||
|
||
import static junit.framework.TestCase.assertNull; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import java.io.IOException; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class JsonObjectMapperDecoderTest { | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
private JsonObjectMapperDecoder j; | ||
|
||
@Before | ||
public void setup() { | ||
j = new JsonObjectMapperDecoder(); | ||
} | ||
|
||
@Test | ||
public void nullKey() throws IOException { | ||
final JsonNode json = mapper.readTree("{\"key\": null}"); | ||
final String key = j.decodeString(json, "key"); | ||
|
||
assertNull(key); | ||
} | ||
|
||
} |