Indentation and Formatting Changes

This commit is contained in:
Muhammad Abdullah Azam Khan 2021-11-26 20:54:37 +04:00
parent 9d464b4f45
commit 86dcb518b2
2 changed files with 24 additions and 24 deletions

View File

@ -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 + '\''
+ '}';
}

View File

@ -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());
}
}