This repository has been archived by the owner on Nov 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from stevenschlansker/breaks-map-deserialization
Show that deserializing Map<String, Object> breaks :(
- Loading branch information
Showing
2 changed files
with
45 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
42 changes: 42 additions & 0 deletions
42
src/test/java/com/fasterxml/jackson/module/mrbean/TestMapStringObjectDeserialization.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,42 @@ | ||
package com.fasterxml.jackson.module.mrbean; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.core.JsonParseException; | ||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.fasterxml.jackson.databind.JsonMappingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
public class TestMapStringObjectDeserialization | ||
extends BaseTest | ||
{ | ||
|
||
/** | ||
* Test simple Map deserialization works. | ||
*/ | ||
public void testMapWithMrbean() throws Exception | ||
{ | ||
ObjectMapper mapper = new ObjectMapper(); | ||
mapper.registerModule(new MrBeanModule()); | ||
|
||
runTest(mapper); | ||
} | ||
|
||
/** | ||
* Test simple Map deserialization works. | ||
*/ | ||
public void testMapWithoutMrbean() throws Exception | ||
{ | ||
ObjectMapper mapper = new ObjectMapper(); | ||
|
||
runTest(mapper); | ||
} | ||
|
||
void runTest(ObjectMapper mapper) throws IOException, JsonParseException, JsonMappingException | ||
{ | ||
Map<String, Object> map = mapper.readValue("{\"test\":3 }", new TypeReference<Map<String, Object>>() {}); | ||
assertEquals(Collections.singletonMap("test", 3), map); | ||
} | ||
} |