### Question:
NonEmptyStringAnnotationFormatterFactory implements
        AnnotationFormatterFactory<NonEmpty> { @Override public Parser<String> getParser(NonEmpty annotation, Class<?> fieldType) { return new Parser<String>() { @Override public String parse(String text, Locale locale) throws ParseException { if (!StringUtils.hasText(text)) { return null; } else { return text; } } }; } NonEmptyStringAnnotationFormatterFactory(); @Override final Set<Class<?>> getFieldTypes(); @Override Printer<String> getPrinter(NonEmpty annotation, Class<?> fieldType); @Override Parser<String> getParser(NonEmpty annotation, Class<?> fieldType);  }### Answer:
@Test public void testGetParser() throws ParseException { final String anyString = "Foo"; Parser<String> parser = testee.getParser(null, String.class); assertThat(parser.parse(null, Locale.getDefault())).isEqualTo(null); assertThat(parser.parse(anyString, null)).isEqualTo(anyString); assertThat(parser.parse(" ", null)).isEqualTo(null); }