### Question:
Node { @Override public boolean equals(Object other) { if (other == null) { return false; } if (other == this) { return true; } if (!(other instanceof Node)) { return false; } Node otherNode = (Node) other; return otherNode.getKey().equals(key); } Node(Vertex vertex, String entityTypeName); String getLabel(); String getType(); String getKey(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void equalsReturnsFalseWhenOtherIsNull() throws IOException { Node underTest = new Node(mockDocumentVertex, null); assertThat(underTest.equals(null), is(false)); }
@Test public void equalsReturnsTrueWhenOtherHasTheSameMemoryReference() throws IOException { Node underTest = new Node(mockDocumentVertex, null); assertThat(underTest.equals(underTest), is(true)); }
@Test public void equalsReturnsFalseWhenOtherIsNotANode() throws IOException { Node underTest = new Node(mockDocumentVertex, null); assertThat(underTest.equals(new Object()), is(false)); }
@Test public void equalsReturnsTrueWhenOtherNodeHasTheSameKey() throws IOException { Node underTest = new Node(mockDocumentVertex, null); Node toCompare = new Node(mockDocumentVertex, null); assertThat(underTest.equals(toCompare), is(true)); assertThat(underTest == toCompare, is(false)); }