GenericNameVersion extends AbstractNameVersion { public static GenericNameVersion of(CharSequence string) { Matcher matcher = NAME_VERSION_PATTERN.matcher(string); while (matcher.matches()) { return ofMatcher(matcher); } return null; } GenericNameVersion(String name, String version); @Override String getName(); GenericNameVersion withVersion(String newVersion); GenericNameVersion withName(String newName); @Override int hashCode(); @Override boolean equals(Object obj); static List<? extends GenericNameVersion> ofAll(CharSequence string); static GenericNameVersion of(CharSequence string); static GenericNameVersion ofFirst(CharSequence string); static GenericNameVersion ofMatcher(Matcher matcher); static String toString(NameVersion... nameVersions);  }
@Test public void testOf() { assertThat(GenericNameVersion.of(MOZILLA_NV)).isEqualTo(MOZILLA); assertThat(GenericNameVersion.of(WEBKIT_NV)).isEqualTo(WEBKIT); assertThat(GenericNameVersion.of(VERSION_NV)).isEqualTo(VERSION); assertThat(GenericNameVersion.of(SAFARI_NV)).isEqualTo(SAFARI); assertThat(GenericNameVersion.of(DEBIAN_NV)).isEqualTo(DEBIAN); assertThat(GenericNameVersion.of(EPIPHANY_NV)).isEqualTo(EPIPHANY); assertThat(GenericNameVersion.of("")).isNull(); assertThat(GenericNameVersion.of("hello world")).isNull(); }