@Test public void getOutputFormatMissingParameter() { String wrongParameterPrefix = "--some-parameter="; String outputFormat = "something"; Map<String, String> parameters = Collections.singletonMap(wrongParameterPrefix, outputFormat); final String setOutputFormat = ReporterParameterParser.getOutputFormat(parameters); assertThat(setOutputFormat).isEqualTo(DEFAULT_OUTPUT_FORMAT); }
static String getOutputFormat(Map<String, String> parameters) { final String outputLong = parameters.get(OUTPUT_FORMAT_PREFIX_LONG); if (outputLong != null) { return outputLong; } else { return Optional.ofNullable(parameters.get(OUTPUT_FORMAT_PREFIX_SHORT)) .orElseGet(() -> { LOGGER.warn("No output format is given."); return DEFAULT_OUTPUT_FORMAT; }); } }
ReporterParameterParser { static String getOutputFormat(Map<String, String> parameters) { final String outputLong = parameters.get(OUTPUT_FORMAT_PREFIX_LONG); if (outputLong != null) { return outputLong; } else { return Optional.ofNullable(parameters.get(OUTPUT_FORMAT_PREFIX_SHORT)) .orElseGet(() -> { LOGGER.warn("No output format is given."); return DEFAULT_OUTPUT_FORMAT; }); } } }
ReporterParameterParser { static String getOutputFormat(Map<String, String> parameters) { final String outputLong = parameters.get(OUTPUT_FORMAT_PREFIX_LONG); if (outputLong != null) { return outputLong; } else { return Optional.ofNullable(parameters.get(OUTPUT_FORMAT_PREFIX_SHORT)) .orElseGet(() -> { LOGGER.warn("No output format is given."); return DEFAULT_OUTPUT_FORMAT; }); } } private  ReporterParameterParser(); }
ReporterParameterParser { static String getOutputFormat(Map<String, String> parameters) { final String outputLong = parameters.get(OUTPUT_FORMAT_PREFIX_LONG); if (outputLong != null) { return outputLong; } else { return Optional.ofNullable(parameters.get(OUTPUT_FORMAT_PREFIX_SHORT)) .orElseGet(() -> { LOGGER.warn("No output format is given."); return DEFAULT_OUTPUT_FORMAT; }); } } private  ReporterParameterParser();  }
ReporterParameterParser { static String getOutputFormat(Map<String, String> parameters) { final String outputLong = parameters.get(OUTPUT_FORMAT_PREFIX_LONG); if (outputLong != null) { return outputLong; } else { return Optional.ofNullable(parameters.get(OUTPUT_FORMAT_PREFIX_SHORT)) .orElseGet(() -> { LOGGER.warn("No output format is given."); return DEFAULT_OUTPUT_FORMAT; }); } } private  ReporterParameterParser();   }