MvcResult result = mvc.perform(get("/api/layers/foo/one"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
JSONObj obj = JSONWrapper.read(result.getResponse().getContentAsString()).toObject();
assertEquals("one", obj.str("name"));
assertEquals("foo", obj.str("workspace"));
assertEquals("vector", obj.str("type"));
assertEquals("The layer", obj.str("title"));
assertEquals("This layer is cool!", obj.str("description"));
assertEquals("EPSG:4326", obj.object("proj").str("srs"));
assertEquals(-180d, obj.object("bbox").object("native").doub("west"), 0.1);
assertEquals(-90d, obj.object("bbox").object("native").doub("south"), 0.1);
assertEquals(180d, obj.object("bbox").object("native").doub("east"), 0.1);
assertEquals(90d, obj.object("bbox").object("native").doub("north"), 0.1);
assertEquals(0d, obj.object("bbox").object("native").array("center").doub(0), 0.1);
assertEquals(0d, obj.object("bbox").object("native").array("center").doub(1), 0.1);
assertEquals(-180d, obj.object("bbox").object("lonlat").doub("west"), 0.1);
assertEquals(-90d, obj.object("bbox").object("lonlat").doub("south"), 0.1);
assertEquals(180d, obj.object("bbox").object("lonlat").doub("east"), 0.1);
assertEquals(90d, obj.object("bbox").object("lonlat").doub("north"), 0.1);
assertEquals(0d, obj.object("bbox").object("lonlat").array("center").doub(0), 0.1);
assertEquals(0d, obj.object("bbox").object("lonlat").array("center").doub(1), 0.1);
assertNotNull(obj.get("modified"));
assertNotNull(obj.get("created"));
String mod = obj.object("modified").str("timestamp");
//TODO: this fails for some configuraitons, like our build server, investigate
//assertTrue(Pattern.compile(".*\\d{2}:\\d{2}").matcher(mod).matches());
}