@Test(expected = IllegalArgumentException.class) @Parameters public void parseBad(String id) { NpmPackageId.parse(id); }
public static NpmPackageId parse(final String string) { String scope = null; String name = checkNotNull(string); int slashIndex = name.indexOf('/'); if (string.startsWith("@") && slashIndex > -1) { scope = name.substring(1, slashIndex); name = name.substring(slashIndex + 1, name.length()); } return new NpmPackageId(scope, name); }
NpmPackageId implements Comparable<NpmPackageId> { public static NpmPackageId parse(final String string) { String scope = null; String name = checkNotNull(string); int slashIndex = name.indexOf('/'); if (string.startsWith("@") && slashIndex > -1) { scope = name.substring(1, slashIndex); name = name.substring(slashIndex + 1, name.length()); } return new NpmPackageId(scope, name); } }
NpmPackageId implements Comparable<NpmPackageId> { public static NpmPackageId parse(final String string) { String scope = null; String name = checkNotNull(string); int slashIndex = name.indexOf('/'); if (string.startsWith("@") && slashIndex > -1) { scope = name.substring(1, slashIndex); name = name.substring(slashIndex + 1, name.length()); } return new NpmPackageId(scope, name); } NpmPackageId(@Nullable final String scope, final String name); }
NpmPackageId implements Comparable<NpmPackageId> { public static NpmPackageId parse(final String string) { String scope = null; String name = checkNotNull(string); int slashIndex = name.indexOf('/'); if (string.startsWith("@") && slashIndex > -1) { scope = name.substring(1, slashIndex); name = name.substring(slashIndex + 1, name.length()); } return new NpmPackageId(scope, name); } NpmPackageId(@Nullable final String scope, final String name); @Nullable String scope(); @Nonnull String name(); @Nonnull String id(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final NpmPackageId o); @Override String toString(); static NpmPackageId parse(final String string); }
NpmPackageId implements Comparable<NpmPackageId> { public static NpmPackageId parse(final String string) { String scope = null; String name = checkNotNull(string); int slashIndex = name.indexOf('/'); if (string.startsWith("@") && slashIndex > -1) { scope = name.substring(1, slashIndex); name = name.substring(slashIndex + 1, name.length()); } return new NpmPackageId(scope, name); } NpmPackageId(@Nullable final String scope, final String name); @Nullable String scope(); @Nonnull String name(); @Nonnull String id(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final NpmPackageId o); @Override String toString(); static NpmPackageId parse(final String string);  }