blob: 22174761571188fa114e532da3735d7c0d93c9e6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.text;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author bratseth
*/
public class JSONTest {
@Test
public void testMapToString() {
Map<String,Object> map = new LinkedHashMap<>();
map.put("a \"key\"", 3);
map.put("key2", "value");
map.put("key3", 3.3);
assertEquals("{\"a \\\"key\\\"\":3,\"key2\":\"value\",\"key3\":3.3}", JSON.encode(map));
}
}
|