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