MvcResult result = mvc.perform(get("/api/workspaces"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
JSONArr arr = JSONWrapper.read(result.getResponse().getContentAsString()).toArray();
assertEquals(2, arr.size());
JSONObj obj = arr.object(0);
assertEquals("foo", obj.str("name"));
assertTrue(obj.bool("default"));
assertEquals("http://scratch.org", obj.str("uri"));
assertTrue(obj.has("modified"));
assertTrue(obj.object("modified").has("timestamp"));
assertTrue(obj.object("modified").has("pretty"));
obj = arr.object(1);
assertEquals("bar", obj.str("name"));
assertFalse(obj.bool("default"));
assertEquals("http://bar.org", obj.str("uri"));
assertTrue(obj.has("modified"));
assertTrue(obj.object("modified").has("timestamp"));