IPv4RangePropertyValueParser { private List<String> parseSemicolonDelimited(String value) { List<String> results = new ArrayList<>(); for (String item : Strings.split(value, ';')) { if (Strings.isBlank(item)) continue; int index = item.indexOf(':'); Arrays.stream(Strings.split(item.substring(index + 1), ',')) .map(String::strip) .forEach(results::add); } return results; } IPv4RangePropertyValueParser(String value); List<String> parse();  }
@Test void parseSemicolonDelimited() { assertThat(new IPv4RangePropertyValueParser("name1: cidr1, cidr2; name2: cidr3,cidr4").parse()).containsExactly("cidr1", "cidr2", "cidr3", "cidr4"); assertThat(new IPv4RangePropertyValueParser("name1: cidr1; name2: cidr3; ").parse()).containsExactly("cidr1", "cidr3"); }