### Question:
NodeBody { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof NodeBody)) { return false; } NodeBody otherNodeBody = (NodeBody) o; return otherNodeBody.height == this.height && otherNodeBody.length == this.length && otherNodeBody.newlineCount == this.newlineCount && otherNodeBody.val.equals(this.val); } private  NodeBody(Builder builder); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object o);  }### Answer:
@Test public void testEquals() { String helloStr = "hello"; NodeBody hello = new NodeBody.Builder() .height(0) .length(helloStr.length()) .newlineCount(countOccurrence(helloStr, NEW_LINE)) .val(new NodeBody.Leaf(helloStr)) .build(); String worldStr = "world"; NodeBody world = new NodeBody.Builder() .height(0) .length(worldStr.length()) .newlineCount(countOccurrence(worldStr, NEW_LINE)) .val(new NodeBody.Leaf(worldStr)) .build(); assertNotEquals(hello, world); NodeBody worldCopy = new NodeBody.Builder() .height(0) .length(worldStr.length()) .newlineCount(countOccurrence(worldStr, NEW_LINE)) .val(new NodeBody.Leaf("world")) .build(); assertEquals(world, worldCopy); }