Refactoring for better Indentation and Formatting
This commit is contained in:
parent
733c7e76b9
commit
9d464b4f45
|
@ -11,10 +11,9 @@ public class User implements Serializable {
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
public User(){
|
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.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.age = age;
|
this.age = age;
|
||||||
|
@ -55,11 +54,13 @@ 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 + '\''
|
||||||
'}';
|
+ '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,22 @@ public class ApplicationUnitTest {
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue