GenericNameVersionComment extends GenericNameVersion implements NameVersionComment { public static List<GenericNameVersionComment> ofAll(CharSequence string) { List<GenericNameVersionComment> segments = new ArrayList<>(); Matcher matcher = NAME_VERSION_COMMENT_PATTERN.matcher(string); while (matcher.find()) { GenericNameVersionComment segment = ofMatcher(matcher); segments.add(segment); } return segments; } 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 testOfAll() { assertThat(GenericNameVersionComment.ofAll(ALL)).containsExactly(MOZILLA, WEBKIT, VERSION, SAFARI, DEBIAN, EPIPHANY); assertThat(GenericNameVersionComment.ofAll("")).isEmpty(); assertThat(GenericNameVersionComment.ofAll("hello world (this is not a version name comment)")).isEmpty(); }