public static Map<String, String> getTrimmedStringCollectionSplitByEquals(
      String str) {
    String[] trimmedList = getTrimmedStrings(str);
    Map<String, String> pairs = new HashMap<>();
    for (String s : trimmedList) {
      if (s.isEmpty()) {
        continue;
      }
      String[] splitByKeyVal = getTrimmedStringsSplitByEquals(s);
      Preconditions.checkArgument(
          splitByKeyVal.length == 2,
          STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG + " Input: " + str);
      boolean emptyKey = org.apache.commons.lang3.StringUtils.isEmpty(splitByKeyVal[0]);
      boolean emptyVal = org.apache.commons.lang3.StringUtils.isEmpty(splitByKeyVal[1]);
      Preconditions.checkArgument(
          !emptyKey && !emptyVal,
          STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG + " Input: " + str);
      pairs.put(splitByKeyVal[0], splitByKeyVal[1]);
    }
    return pairs;
  }
@Test
  public void testStringCollectionSplitByEqualsFailure() throws Exception {
    intercept(
        IllegalArgumentException.class,
        STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG,
        () -> StringUtils.getTrimmedStringCollectionSplitByEquals(" = element.abc.val1"));

    intercept(
        IllegalArgumentException.class,
        STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG,
        () -> StringUtils.getTrimmedStringCollectionSplitByEquals("element.abc.key1="));

    intercept(
        IllegalArgumentException.class,
        STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG,
        () -> StringUtils.getTrimmedStringCollectionSplitByEquals("="));

    intercept(
        IllegalArgumentException.class,
        STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG,
        () -> StringUtils.getTrimmedStringCollectionSplitByEquals("== = =    ="));

    intercept(
        IllegalArgumentException.class,
        STRING_COLLECTION_SPLIT_EQUALS_INVALID_ARG,
        () -> StringUtils.getTrimmedStringCollectionSplitByEquals(",="));
  }