ReporterParameterParser { static Map<String, String> mapParameters(Set<String> parameters) { return parameters.stream() .map(p -> p.split(AbstractAntennaCLIOptions.PARAMETER_IDENTIFIER)) .filter(sa -> { if (sa.length != 2) { throw new IllegalArgumentException(Arrays.toString(sa) + " does not have the proper format."); } else { return true; } }) .collect(Collectors.toMap(sa -> sa[0], sa -> sa[1])); } private  ReporterParameterParser();   }
@Test(expected = IllegalStateException.class) public void mapParametersFromMultipleInfoParameters() { ReporterParameterParser.mapParameters(new HashSet<>(Arrays.asList(REPORTER_PARAMETER_PREFIX + "=first", REPORTER_PARAMETER_PREFIX + "=second"))); }
@Test(expected = IllegalArgumentException.class) public void mapParametersFromParameterWithoutValueAfterParameterIdentifier() { Set<String> parameters = Collections.singleton(id + AbstractAntennaCLIOptions.PARAMETER_IDENTIFIER); ReporterParameterParser.mapParameters(parameters); fail("Did not throw expected exception"); }
@Test(expected = IllegalArgumentException.class) public void mapParametersFromParameterWithTwoParameterIdentifier() { Set<String> parameters = Collections.singleton(id + AbstractAntennaCLIOptions.PARAMETER_IDENTIFIER + "mockValue" + AbstractAntennaCLIOptions.PARAMETER_IDENTIFIER + "mockValue2"); ReporterParameterParser.mapParameters(parameters); fail("Did not throw expected exception"); }