OrganizationSectionsSplitter implements Serializable { public List<String> splitToSections(String organizationName) { String[] sectionsArray = StringUtils.split(organizationName, ",;"); List<String> sections = Lists.newArrayList(); for (int i=0; i<sectionsArray.length; ++i) { String section = sectionsArray[i].trim(); if (StringUtils.isNotBlank(section) && !RESTRICTED_SECTIONS.contains(section)) { sections.add(section); } } return sections; }  List<String> splitToSections(String organizationName); List<OrganizationSection> splitToSectionsDetailed(String organizationName);  }
@Test public void splitToSections() { assertThat(sectionsSplitter.splitToSections(""), iterableWithSize(0)); assertThat(sectionsSplitter.splitToSections(","), iterableWithSize(0)); assertThat(sectionsSplitter.splitToSections("aa"), contains("aa")); assertThat(sectionsSplitter.splitToSections("aa, bb, cc"), contains("aa", "bb", "cc")); assertThat(sectionsSplitter.splitToSections("aa; bb; cc"), contains("aa", "bb", "cc")); assertThat(sectionsSplitter.splitToSections("aa; bb; ltd"), contains("aa", "bb")); assertThat(sectionsSplitter.splitToSections("aa; inc; cc"), contains("aa", "cc")); }