### Question:
MultiWordFormatterFactory implements AnnotationFormatterFactory<MultiWordFormat>, Formatter<List<String>> { @Override public List<String> parse(String source, Locale locale) throws ParseException { if (StringUtils.isBlank(source)) { return Collections.emptyList(); } return Lists.newArrayList(source.trim().split("\\s*\\|\\s*")).stream() .filter(x -> StringUtils.isNotBlank(x)) .collect(Collectors.toList()); } MultiWordFormatterFactory(); @Override Set<Class<?>> getFieldTypes(); @Override Printer<?> getPrinter(MultiWordFormat annotation, Class<?> fieldType); @Override Parser<?> getParser(MultiWordFormat annotation, Class<?> fieldType); @Override String print(List<String> value, Locale locale); @Override List<String> parse(String source, Locale locale);  }### Answer:
@Test public void parse_EMPTY() throws ParseException { assertEquals(Lists.newArrayList(), multiWordFormatter.parse(null, null)); }
@Test public void parse_SIMPLE() throws ParseException { String entry = "slowo1|slowo2|slowo3"; List<String> expected = Lists.newArrayList("slowo1", "slowo2", "slowo3"); List<String> actual = multiWordFormatter.parse(entry, null); assertEquals(expected, actual); }
@Test public void parse_TRIM() throws ParseException { String entry = " slowo1 | slowo2 "; List<String> expected = Lists.newArrayList("slowo1", "slowo2"); List<String> actual = multiWordFormatter.parse(entry, null); assertEquals(expected, actual); }
@Test public void parse_COMPLEX() throws ParseException { String entry = "Zbyszek Brzęczy-szczykiewicz| sędzia. anna-maria wesołowska"; List<String> expected = Lists.newArrayList("Zbyszek Brzęczy-szczykiewicz", "sędzia. anna-maria wesołowska"); List<String> actual = multiWordFormatter.parse(entry, null); assertEquals(expected, actual); }
@Test public void parse_BOUNDARY_SEPARATORS() throws ParseException { String entry = "|,|b| . |"; List<String> expected = Lists.newArrayList(",", "b", "."); List<String> actual = multiWordFormatter.parse(entry, null); assertEquals(expected, actual); }
@Test public void parse_DOUBLE_SEPARATOR() throws ParseException { String entry = "a | | b||c"; List<String> expected = Lists.newArrayList("a", "b", "c"); List<String> actual = multiWordFormatter.parse(entry, null); assertEquals(expected, actual); }