### Question:
VertexLabel { public VertexLabel withoutOuterNamespace() { List<String> reducedNamespace = namespace.subList(1, namespace.size()); return new VertexLabel(reducedNamespace, this.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 youCanDiminishTheNamespace() { String innerNamespace = "inner"; String outerNamespace = "outer"; String name = "foo"; VertexLabel foo = new VertexLabel(outerNamespace, innerNamespace, name); VertexLabel newFoo = foo.withoutOuterNamespace(); assertThat(newFoo, equalTo(new VertexLabel(innerNamespace, name))); }
@Test(expected = IllegalArgumentException.class) public void itThrowsIfYouDiminishTheNamespaceButThereIsNone() { VertexLabel foo = new VertexLabel("foo"); foo.withoutOuterNamespace(); }
@Test(expected = IndexOutOfBoundsException.class) public void itThrowsIfYouRemoveExistingOuterNamespaceUntilThereIsNone() { VertexLabel foo = new VertexLabel("namespace", "foo"); foo = foo.withoutOuterNamespace(); foo.withoutOuterNamespace(); }