Closed oscarfonts closed 9 years ago
Creating HashMap:
Map<String, String> paths = new HashMap<String, String>();
paths.put("foo", "http://boh");
paths.put("bar", "http://bohboh");
paths.put("boh", "http://bohbohboh");
Which is afterwards serialized as a JSON string. The test expects HashMap insertion order to be kept, which is not, by definition (see http://stackoverflow.com/questions/10710193/how-to-preserve-insertion-order-in-hashmap):
assertTrue(output.indexOf("\"foo\":\"http://boh\","
+ "\"bar\":\"http://bohboh\","
+ "\"boh\":\"http://bohbohboh\"") != -1);
In my case, string renders "bar" before "foo". Can be solved using LinkedHashMap instead.
Test set: org.fao.unredd.jwebclientAnalyzer.RequireTemplateTest
checkGenerate(org.fao.unredd.jwebclientAnalyzer.RequireTemplateTest) Time elapsed: 0.01 sec <<< FAILURE! junit.framework.AssertionFailedError: null at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.assertTrue(Assert.java:20) at junit.framework.Assert.assertTrue(Assert.java:27) at org.fao.unredd.jwebclientAnalyzer.RequireTemplateTest.checkGenerate(RequireTemplateTest.java:33)