PackageName { public static PackageName of(String value) { Preconditions.checkNotNull(value); String sanitizedValue = sanitize(value); Preconditions.checkArgument(!hasEmptyParts(sanitizedValue), "PackageName can not contain empty parts: " + sanitizedValue); return new PackageName(sanitizedValue); } private  PackageName(String name); static PackageName of(String value); String getName(); @Override final boolean equals(Object o); @Override final int hashCode();  }
@Test void ofShouldThrowWhenNull() { assertThatThrownBy(() -> PackageName.of(null)) .isInstanceOf(NullPointerException.class); }
@Test void ofShouldThrowWhenEmpty() { assertThatThrownBy(() -> PackageName.of("")) .isInstanceOf(IllegalArgumentException.class); }
@Test void ofShouldThrowWhenStartingDot() { assertThatThrownBy(() -> PackageName.of(".org.apache.MyClass")) .isInstanceOf(IllegalArgumentException.class); }
@Test void ofShouldThrowWhenDoubleDot() { assertThatThrownBy(() -> PackageName.of("org.apache..MyClass")) .isInstanceOf(IllegalArgumentException.class); }