Permalink
Browse files

修复Struts2UtilsTest测试结果错误

  • Loading branch information...
1 parent 7e40c53 commit a38675634a1b094560c1759d78beac12c17c7853 @henryyan committed Jan 18, 2012
@@ -69,22 +69,22 @@ public void renderJson() throws IOException {
WebTestUtils.setResponseToStruts2(response);
Object object = new TestBean();
Struts2Utils.renderJson(object);
- assertEquals("{\"age\":10,\"name\":\"foo\"}", response.getContentAsString());
+ assertEquals("{\"name\":\"foo\",\"age\":10}", response.getContentAsString());
//Array
response = new MockHttpServletResponse();
WebTestUtils.setResponseToStruts2(response);
TestBean[] array = { new TestBean(), new TestBean() };
Struts2Utils.renderJson(array);
- assertEquals("[{\"age\":10,\"name\":\"foo\"},{\"age\":10,\"name\":\"foo\"}]", response.getContentAsString());
+ assertEquals("[{\"name\":\"foo\",\"age\":10},{\"name\":\"foo\",\"age\":10}]", response.getContentAsString());
//Collection
response = new MockHttpServletResponse();
WebTestUtils.setResponseToStruts2(response);
List<TestBean> list = Lists.newArrayList(new TestBean(), new TestBean());
Struts2Utils.renderJson(list);
- assertEquals("[{\"age\":10,\"name\":\"foo\"},{\"age\":10,\"name\":\"foo\"}]", response.getContentAsString());
+ assertEquals("[{\"name\":\"foo\",\"age\":10},{\"name\":\"foo\",\"age\":10}]", response.getContentAsString());
}
@Test

0 comments on commit a386756

Please sign in to comment.