Indentation and Formatting Changes
This commit is contained in:
parent
9d464b4f45
commit
86dcb518b2
|
@ -55,11 +55,11 @@ public class User implements Serializable {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "User{"
|
||||
+ "id=" + id
|
||||
+ ", name='" + name + '\''
|
||||
+ ", age=" + age
|
||||
+ ", address='" + address + '\''
|
||||
+ '}';
|
||||
+ "id=" + id
|
||||
+ ", name='" + name + '\''
|
||||
+ ", age=" + age
|
||||
+ ", address='" + address + '\''
|
||||
+ '}';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,39 +20,39 @@ public class ApplicationUnitTest {
|
|||
@Test
|
||||
public void JsonTestCase() throws Exception {
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
|
||||
.contentType(MediaType.APPLICATION_JSON_VALUE)
|
||||
.content( "{\n"
|
||||
+ " \"name\": \"Andy\",\n"
|
||||
+ " \"age\": 1,\n"
|
||||
+ " \"address\": \"Hello world\"\n"
|
||||
+ "}"))
|
||||
.andExpect(status().isOk());
|
||||
.contentType(MediaType.APPLICATION_JSON_VALUE)
|
||||
.content( "{\n"
|
||||
+ " \"name\": \"Andy\",\n"
|
||||
+ " \"age\": 1,\n"
|
||||
+ " \"address\": \"Hello world\"\n"
|
||||
+ "}"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void JsonFailTestCase() throws Exception {// Because no content-type added
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
|
||||
.content( "{\n"
|
||||
+ " \"name\": \"Andy\",\n"
|
||||
+ " \"age\": 1,\n"
|
||||
+ " \"address\": \"Hello world\"\n"
|
||||
+ "}"))
|
||||
.andExpect(status().isUnsupportedMediaType());
|
||||
.content( "{\n"
|
||||
+ " \"name\": \"Andy\",\n"
|
||||
+ " \"age\": 1,\n"
|
||||
+ " \"address\": \"Hello world\"\n"
|
||||
+ "}"))
|
||||
.andExpect(status().isUnsupportedMediaType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void XmlTestCase() throws Exception {
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
|
||||
.contentType(MediaType.APPLICATION_XML_VALUE)
|
||||
.content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>"))
|
||||
.andExpect(status().isOk());
|
||||
.contentType(MediaType.APPLICATION_XML_VALUE)
|
||||
.content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void StringFailTestCase() throws Exception { // Because content-type is not supported
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
|
||||
.contentType(MediaType.TEXT_PLAIN_VALUE)
|
||||
.content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>"))
|
||||
.andExpect(status().isUnsupportedMediaType());
|
||||
.contentType(MediaType.TEXT_PLAIN_VALUE)
|
||||
.content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>"))
|
||||
.andExpect(status().isUnsupportedMediaType());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue