@Test void parseShouldFailIfCalledWhenMissingMappingParts() { assertThatThrownBy(() -> MappingArgument.parse("key1;value1,key2")) .isInstanceOf(IllegalArgumentException.class); }
public static ImmutableMap<String, String> parse(String mapping) throws MessagingException { Preconditions.checkArgument(mapping != null, "mapping should not be null"); if (mapping.trim().isEmpty()) { return ImmutableMap.of(); } return Splitter.on(',') .omitEmptyStrings() .splitToList(mapping) .stream() .map(MappingArgument::parseKeyValue) .collect(Guavate.toImmutableMap(Pair::getLeft, Pair::getRight)); }
MappingArgument { public static ImmutableMap<String, String> parse(String mapping) throws MessagingException { Preconditions.checkArgument(mapping != null, "mapping should not be null"); if (mapping.trim().isEmpty()) { return ImmutableMap.of(); } return Splitter.on(',') .omitEmptyStrings() .splitToList(mapping) .stream() .map(MappingArgument::parseKeyValue) .collect(Guavate.toImmutableMap(Pair::getLeft, Pair::getRight)); } }
MappingArgument { public static ImmutableMap<String, String> parse(String mapping) throws MessagingException { Preconditions.checkArgument(mapping != null, "mapping should not be null"); if (mapping.trim().isEmpty()) { return ImmutableMap.of(); } return Splitter.on(',') .omitEmptyStrings() .splitToList(mapping) .stream() .map(MappingArgument::parseKeyValue) .collect(Guavate.toImmutableMap(Pair::getLeft, Pair::getRight)); }  }
MappingArgument { public static ImmutableMap<String, String> parse(String mapping) throws MessagingException { Preconditions.checkArgument(mapping != null, "mapping should not be null"); if (mapping.trim().isEmpty()) { return ImmutableMap.of(); } return Splitter.on(',') .omitEmptyStrings() .splitToList(mapping) .stream() .map(MappingArgument::parseKeyValue) .collect(Guavate.toImmutableMap(Pair::getLeft, Pair::getRight)); }  static ImmutableMap<String, String> parse(String mapping); }
MappingArgument { public static ImmutableMap<String, String> parse(String mapping) throws MessagingException { Preconditions.checkArgument(mapping != null, "mapping should not be null"); if (mapping.trim().isEmpty()) { return ImmutableMap.of(); } return Splitter.on(',') .omitEmptyStrings() .splitToList(mapping) .stream() .map(MappingArgument::parseKeyValue) .collect(Guavate.toImmutableMap(Pair::getLeft, Pair::getRight)); }  static ImmutableMap<String, String> parse(String mapping); static String CONFIGURATION_ERROR_MESSAGE; }