### Question:
OutputFormatsHandler implements CliOptionHandler { @Override public void handle(String optionValue, Options options) { Set<OutputFormat> formats = ImmutableSet.of(OutputFormat.STDOUT); if (!StringUtils.isBlank(optionValue)) { try { String[] formatStrings = optionValue.split(","); formats = Arrays.stream(formatStrings).map(String::trim).map(String::toUpperCase).map(OutputFormat::valueOf).collect(toSet()); } catch (IllegalArgumentException e) { log.debug("Format cannot be resolved", e); } } options.setOutputFormats(ImmutableSet.copyOf(formats)); }  @Override void handle(String optionValue, Options options); @Override CliOption getHandledCliOption(); @Override String getHelpMessage();  }### Answer:
@Test public void testHandleShouldSetFormatToStandardOutWhenPropertyValueIsNull() { Options options = new Options(); underTest.handle(null, options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.STDOUT)); }
@Test public void testHandleShouldSetFormatToStandardOutWhenPropertyValueIsEmpty() { Options options = new Options(); underTest.handle("", options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.STDOUT)); }
@Test public void testHandleShouldSetFormatToStandardOutWhenPropertyValueIsNotMappable() { Options options = new Options(); underTest.handle("something", options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.STDOUT)); }
@Test public void testHandleShouldSetFormatToStandardOutWhenPropertyValueIsStdOut() { Options options = new Options(); underTest.handle("stdout", options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.STDOUT)); }
@Test public void testHandleShouldSetFormatToJsonWhenPropertyValueIsJson() { Options options = new Options(); underTest.handle("json", options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.JSON)); }
@Test public void testHandleShouldSetFormatToJsonAndHtmlWhenValueIsJsonCommaHtml() { Options options = new Options(); underTest.handle("json,html", options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.HTML, OutputFormat.JSON)); }
@Test public void testHandleShouldSetFormatToJsonAndHtmlWhenValueIsJsonCommaHtmlWithSpaces() { Options options = new Options(); underTest.handle("json, html", options); assertThat(options.getOutputFormats()).isEqualTo(of(OutputFormat.HTML, OutputFormat.JSON)); }