Created
January 31, 2014 03:46
-
-
Save mid0111/8726316 to your computer and use it in GitHub Desktop.
assert to nested Map
This file contains hidden or 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
import org.codehaus.jackson.map.ObjectMapper; | |
public class QueryMapFactoryTest { | |
@Test | |
public void クエリを作成できること() { | |
Map<String, Object> actual = QueryMapFactoryTest.getQuery(); | |
String expectedStr = "{" | |
+ " \"query\": {" | |
+ " \"bool\": {" | |
+ " \"must\": [" | |
+ " {" | |
+ " \"term\": {" | |
+ " \"l.xxx\": \"xxxx\"" | |
+ " }" | |
+ " }," | |
+ " {" | |
+ " \"term\": {" | |
+ " \"s.yyy.untouched\": false" | |
+ " }" | |
+ " }" | |
+ " ]" | |
+ " }" | |
+ " }," | |
+ " \"filter\": {" | |
+ " \"and\": {" | |
+ " \"filters\": [" | |
+ " {" | |
+ " \"term\": {" | |
+ " \"c\": \"cccc\"" | |
+ " }" | |
+ " }," | |
+ " {" | |
+ " \"term\": {" | |
+ " \"b\": \"bbbb\"" | |
+ " }" | |
+ " }," | |
+ " {" | |
+ " \"term\": {" | |
+ " \"a\": \"aaaa\"" | |
+ " }" | |
+ " }," | |
+ " {" | |
+ " \"term\": {" | |
+ " \"d\": \"dddd\"" | |
+ " }" | |
+ " }" | |
+ " ]" | |
+ " }" | |
+ " }," | |
+ " \"size\": 10," | |
+ " \"version\": true" | |
+ "}"; | |
Map<String, Integer> expected = null; | |
try { | |
expected = new ObjectMapper().readValue(expectedStr, HashMap.class); | |
} catch (IOException e) { | |
fail(e.getMessage()); | |
} | |
assertEquals(expected, actual); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment