@Test void ofShouldThrowWhenDoubleDot() { assertThatThrownBy(() -> PackageName.of("org.apache..MyClass")) .isInstanceOf(IllegalArgumentException.class); }
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); }
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); } }
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); }
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(); }
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();  }