GenericNameVersionComment extends GenericNameVersion implements NameVersionComment { public static GenericNameVersionComment of(CharSequence string) { Matcher matcher = NAME_VERSION_COMMENT_PATTERN.matcher(string); while (matcher.matches()) { return ofMatcher(matcher); } return null; } GenericNameVersionComment(String name, String version, String comment); @Override String getComment(); @Override int hashCode(); @Override boolean equals(Object obj); @Override GenericNameVersionComment withVersion(String newVersion); @Override GenericNameVersionComment withName(String newName); GenericNameVersionComment withComment(String newComment); static GenericNameVersionComment of(CharSequence string); static List<GenericNameVersionComment> ofAll(CharSequence string); static GenericNameVersionComment ofFirst(CharSequence string); static GenericNameVersionComment ofMatcher(Matcher matcher);  }
@Test public void testOf() { assertThat(GenericNameVersionComment.of(MOZILLA_NVC)).isEqualTo(MOZILLA); assertThat(GenericNameVersionComment.of(WEBKIT_NVC)).isEqualTo(WEBKIT); assertThat(GenericNameVersionComment.of(VERSION_NV)).isEqualTo(VERSION); assertThat(GenericNameVersionComment.of(SAFARI_NV)).isEqualTo(SAFARI); assertThat(GenericNameVersionComment.of(DEBIAN_NVC)).isEqualTo(DEBIAN); assertThat(GenericNameVersionComment.of(EPIPHANY_NV)).isEqualTo(EPIPHANY); assertThat(GenericNameVersionComment.of("")).isNull(); assertThat(GenericNameVersionComment.of("hello world")).isNull(); }