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 @Override
public String toString() { public String toString() {
return "User{" return "User{"
+ "id=" + id + "id=" + id
+ ", name='" + name + '\'' + ", name='" + name + '\''
+ ", age=" + age + ", age=" + age
+ ", address='" + address + '\'' + ", address='" + address + '\''
+ '}'; + '}';
} }

View File

@ -20,39 +20,39 @@ public class ApplicationUnitTest {
@Test @Test
public void JsonTestCase() throws Exception { public void JsonTestCase() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/user/") mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.contentType(MediaType.APPLICATION_JSON_VALUE) .contentType(MediaType.APPLICATION_JSON_VALUE)
.content( "{\n" .content( "{\n"
+ " \"name\": \"Andy\",\n" + " \"name\": \"Andy\",\n"
+ " \"age\": 1,\n" + " \"age\": 1,\n"
+ " \"address\": \"Hello world\"\n" + " \"address\": \"Hello world\"\n"
+ "}")) + "}"))
.andExpect(status().isOk()); .andExpect(status().isOk());
} }
@Test @Test
public void JsonFailTestCase() throws Exception {// Because no content-type added public void JsonFailTestCase() throws Exception {// Because no content-type added
mockMvc.perform(MockMvcRequestBuilders.post("/user/") mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.content( "{\n" .content( "{\n"
+ " \"name\": \"Andy\",\n" + " \"name\": \"Andy\",\n"
+ " \"age\": 1,\n" + " \"age\": 1,\n"
+ " \"address\": \"Hello world\"\n" + " \"address\": \"Hello world\"\n"
+ "}")) + "}"))
.andExpect(status().isUnsupportedMediaType()); .andExpect(status().isUnsupportedMediaType());
} }
@Test @Test
public void XmlTestCase() throws Exception { public void XmlTestCase() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/user/") mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.contentType(MediaType.APPLICATION_XML_VALUE) .contentType(MediaType.APPLICATION_XML_VALUE)
.content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>")) .content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>"))
.andExpect(status().isOk()); .andExpect(status().isOk());
} }
@Test @Test
public void StringFailTestCase() throws Exception { // Because content-type is not supported public void StringFailTestCase() throws Exception { // Because content-type is not supported
mockMvc.perform(MockMvcRequestBuilders.post("/user/") mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.contentType(MediaType.TEXT_PLAIN_VALUE) .contentType(MediaType.TEXT_PLAIN_VALUE)
.content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>")) .content("<user><name>Andy</name><age>1</age><address>Hello world</address></user>"))
.andExpect(status().isUnsupportedMediaType()); .andExpect(status().isUnsupportedMediaType());
} }
} }