### Question:
VertexLabel { @Override public int hashCode() { return Objects.hash(namespace, name); } VertexLabel(String name);  VertexLabel(String outer, String... inner);  VertexLabel(List<String> namespace, String name); boolean isInNamespace(String... namespace); VertexLabel withExtraNamespace(String topLevelNamespace); VertexLabel withoutOuterNamespace(); Optional<String> getOuterNamespace(); String getUnqualifiedName(); String getQualifiedName(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static VertexLabel parseLabel(String label);  }### Answer:
@Test public void vertexLabelsWithTheSameNameAreEqual() { VertexLabel foo1 = new VertexLabel("foo"); VertexLabel foo2 = new VertexLabel("foo"); assertThat(foo1, equalTo(foo2)); assertThat(foo1.hashCode(), equalTo(foo2.hashCode())); }
@Test public void vertexLabelsWithDifferentNamesAreNotEqual() { VertexLabel foo = new VertexLabel("foo"); VertexLabel bar = new VertexLabel("bar"); assertThat(foo, not(equalTo(bar))); assertThat(foo.hashCode(), not(equalTo(bar.hashCode()))); }
@Test public void vertexLabelsWithTheSameNameButDifferentNamespacesAreNotEqual() { VertexLabel foo1 = new VertexLabel("namespace1", "foo"); VertexLabel foo2 = new VertexLabel("namespace2", "foo"); assertThat(foo1, not(equalTo(foo2))); assertThat(foo1.hashCode(), not(equalTo(foo2.hashCode()))); }
@Test public void aVertexLabelsWithANamespaceIsNoteEqualToOneWithoutANamespace() { VertexLabel foo1 = new VertexLabel("namespace", "foo"); VertexLabel foo2 = new VertexLabel("foo"); assertThat(foo1, not(equalTo(foo2))); assertThat(foo1.hashCode(), not(equalTo(foo2.hashCode()))); }
@Test public void vertexLabelsWithTheSameNamespaceDifferentNamesAreNotEqual() { VertexLabel foo = new VertexLabel("namespace", "foo"); VertexLabel bar = new VertexLabel("namespace", "bar"); assertThat(foo, not(equalTo(bar))); assertThat(foo.hashCode(), not(equalTo(bar.hashCode()))); }