### Question:
VertexLabel { public VertexLabel withExtraNamespace(String topLevelNamespace) { List<String> newNamespace = ImmutableList.<String>builder().add(topLevelNamespace).addAll(namespace).build(); return new VertexLabel(newNamespace, 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 youCanSetTheNamespace() { String namespace = "namespace"; String name = "foo"; VertexLabel foo = new VertexLabel(name); VertexLabel newFoo = foo.withExtraNamespace(namespace); assertThat(newFoo, equalTo(new VertexLabel(namespace, name))); }
@Test public void youCanAugmentTheNamespace() { String innerNamespace = "inner"; String outerNamespace = "outer"; String name = "foo"; VertexLabel foo = new VertexLabel(innerNamespace, name); VertexLabel newFoo = foo.withExtraNamespace(outerNamespace); assertThat(newFoo, equalTo(new VertexLabel(outerNamespace, innerNamespace, name))); }
@Test public void throwsWhenAddingNullExtraNamespace() { expectedException.expect(NullPointerException.class); VertexLabel label = new VertexLabel("outer", "inner", "foo"); label.withExtraNamespace(null); }