-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
1f46a9b
commit fa5b2f2
Showing
2 changed files
with
49 additions
and
0 deletions.
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
48 changes: 48 additions & 0 deletions
48
src/test/java/net/openhft/chronicle/wire/issue/Issue844Test.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,48 @@ | ||
package net.openhft.chronicle.wire.issue; | ||
|
||
import net.openhft.chronicle.wire.WireTestCommon; | ||
import net.openhft.chronicle.wire.WireType; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class Issue844Test extends WireTestCommon { | ||
|
||
@Test | ||
public void nestedMapsJson() { | ||
|
||
// at least 3 levels of nested to reproduce this issue | ||
Object o2 = WireType.JSON_ONLY.fromString("\"serviceConfig\": {\n" + | ||
" \"db\": {\n" + | ||
" \"a\": {\n" + | ||
" \"Hello\": \"World\"\n" + | ||
" },\n" + | ||
" \"mongodb\": {\n" + | ||
" \"@net.openhft.chronicle.wire.issue.Issue844Test$Enum\": \"INSTANCE\"\n" + | ||
" },\n" + | ||
" \"collection\": \"ladder\"\n" + | ||
" }\n" + | ||
"}"); | ||
assertEquals( | ||
"serviceConfig: {\n" + | ||
" db: {\n" + | ||
" a: {\n" + | ||
" Hello: World\n" + | ||
" },\n" + | ||
" mongodb: !net.openhft.chronicle.wire.issue.Issue844Test$Enum INSTANCE,\n" + | ||
" collection: ladder\n" + | ||
" }\n" + | ||
"}\n", | ||
WireType.YAML_ONLY.asString(o2)); | ||
assertEquals( | ||
"{\"serviceConfig\":{\"db\":{\"a\":{\"Hello\":\"World\"},\"mongodb\":{\"@net.openhft.chronicle.wire.issue.Issue844Test$Enum\":\"INSTANCE\"},\"collection\":\"ladder\"}}}", | ||
WireType.JSON_ONLY.asString(o2) | ||
); | ||
} | ||
|
||
|
||
public enum Enum { | ||
INSTANCE | ||
} | ||
|
||
} |