我正在比较这两个对象,但预期对象不等于实际对象。但它们具有相同的值。请提供一些帮助。
为什么 ?
public testJsonToObject() {
Hello expected = new Hello();
String json = "{\"id\":5,\"name\":\"Family\",\"deleteable\
":\"false\"}";
Hello actual = (Hello) mapper.readValue(json, Hello.class);
System.out.println("Family " + actual);
expected.setId(5);
expected.setName("Family");
expected.setDeleteable(false);
System.out.println(expected);
Assert.assertEqual(expected, actual);
}
简单的波乔
Class Hello
public class Hello {
private int id;
private String name;
private boolean deleteable;
/* Getter and Setters*/
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isDeleteable() {
return deleteable;
}
public void setDeleteable(boolean deleteable) {
this.deleteable = deleteable;
}
}
为什么这没有给我预期的结果?