ArgumentParser { public List<String> getStringListForTag(String tag, String exceptionMessage) throws SyntaxException { Argument argument = retrieveArgumentIfExists(tag, exceptionMessage); if (argument == null) { return new ArrayList<String>(); } return retrieveStringValues(argument, exceptionMessage); } ArgumentParser(List<Argument> arguments); void initialize(List<Argument> arguments); String getStringValueForTag(String tag, String exceptionMessage); Integer getNumericValueForTag(String tag, String exceptionMessage); List<String> getStringListForTag(String tag, String exceptionMessage); Set<String> getSingleTags(); String getRemainingStringValue(String exceptionMessage); void throwOnUnvalidSeenSingleTag(String... validTags); void throwOnUnvalidSeenTagWithValue(String... validTags);  }
@Test public void getStringListForTagShouldWorkWithSingleValue() throws Exception { ArgumentParser argumentParser = new ArgumentParser(Lists.newArrayList(ANY_TAG_ARGUMENT, SINGLE_STRING_ARGUMENT)); assertThat(argumentParser.getStringListForTag(ANY_TAG, EXCEPTION_MESSAGE)).containsExactly(STRING_VALUE); }
@Test(expected = SyntaxException.class) public void getStringListForTagShouldThrowWhenUsedWithNumberArgument() throws Exception { ArgumentParser argumentParser = new ArgumentParser(Lists.newArrayList(ANY_TAG_ARGUMENT, NUMBER_ARGUMENT)); argumentParser.getStringListForTag(ANY_TAG, EXCEPTION_MESSAGE); }
@Test public void getStringListForTagShouldWork() throws Exception { ArgumentParser argumentParser = new ArgumentParser(Lists.newArrayList(ANY_TAG_ARGUMENT, STRING_LIST_ARGUMENT)); assertThat(argumentParser.getStringListForTag(ANY_TAG, EXCEPTION_MESSAGE)).containsOnly(STRING_VALUE, STRING_VALUE_2); }
@Test public void getStringListForTagShouldReturnNullWhenUsedOnAnOtherTag() throws Exception { ArgumentParser argumentParser = new ArgumentParser(Lists.newArrayList(OTHER_TAG_ARGUMENT, STRING_LIST_ARGUMENT)); assertThat(argumentParser.getStringListForTag(ANY_TAG, EXCEPTION_MESSAGE)).isEmpty(); }
@Test public void getStringListForTagShouldReturnEmptyByDefault() throws Exception { ArgumentParser argumentParser = new ArgumentParser(Lists.<Argument>newArrayList()); assertThat(argumentParser.getStringListForTag(ANY_TAG, EXCEPTION_MESSAGE)).isEmpty(); }