Refactoring for better Indentation and Formatting

This commit is contained in:
Muhammad Abdullah Azam Khan 2021-11-05 18:32:19 +04:00
parent 733c7e76b9
commit 9d464b4f45
3 changed files with 26 additions and 25 deletions

View File

@ -11,10 +11,9 @@ public class User implements Serializable {
private String address;
public User(){
}
public User(Integer id, String name, Integer age, String address){
public User(Integer id, String name, Integer age, String address) {
this.id = id;
this.name = name;
this.age = age;
@ -55,11 +54,13 @@ public class User implements Serializable {
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
", address='" + address + '\'' +
'}';
return "User{"
+ "id=" + id
+ ", name='" + name + '\''
+ ", age=" + age
+ ", address='" + address + '\''
+ '}';
}
}

View File

@ -21,22 +21,22 @@ public class ApplicationUnitTest {
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" +
"}"))
.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" +
"}"))
.content( "{\n"
+ " \"name\": \"Andy\",\n"
+ " \"age\": 1,\n"
+ " \"address\": \"Hello world\"\n"
+ "}"))
.andExpect(status().isUnsupportedMediaType());
}