class 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));
    }

}