Mercurial > dive4elements > framework
comparison artifacts-common/src/test/java/org/dive4elements/artifacts/common/utils/JSONTest.java @ 583:0135bf3bd92b 3.2.x
Add minimal test for JSON utility class
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 02 Nov 2023 15:09:22 +0100 |
parents | |
children | efbdaf72aafe |
comparison
equal
deleted
inserted
replaced
582:0d492fc47869 | 583:0135bf3bd92b |
---|---|
1 package org.dive4elements.artifacts.common.utils; | |
2 | |
3 import static org.junit.Assert.assertEquals; | |
4 | |
5 import java.util.HashMap; | |
6 import java.util.Map; | |
7 | |
8 import org.junit.Test; | |
9 | |
10 public class JSONTest { | |
11 @Test | |
12 public void toJSONString() { | |
13 final Map<String, Object> json = new HashMap<>(); | |
14 json.put("number", 0); | |
15 json.put("boolean", true); | |
16 json.put("string", "test"); | |
17 final Map<String, Object> object = new HashMap<>(); | |
18 object.put("test", "test"); | |
19 json.put("object", object); | |
20 | |
21 assertEquals("{" | |
22 + "\"number\":0," | |
23 + "\"boolean\":true," | |
24 + "\"string\":\"test\"," | |
25 + "\"object\":{\"test\":\"test\"}" | |
26 + "}", | |
27 JSON.toJSONString(json)); | |
28 } | |
29 } |