private static Map<String, Map<String, String>> eqClusterEnv(final ClusterEnvWrapper wrapper) {
    EasyMock.reportMatcher(new IArgumentMatcher() {
      @Override
      public boolean matches(Object argument) {
        if (argument instanceof Map) {
          Map<String, Map<String, String>> map = (Map<String, Map<String, String>>) argument;
          if (map.containsKey("cluster-env")) {
            wrapper.updateClusterEnvMap(map.get("cluster-env"));
            return true;
          }
        }
        return false;
      }

      @Override
      public void appendTo(StringBuffer buffer) {
        buffer.append("eqClusterEnv(");
        buffer.append(wrapper);
        buffer.append(")");
      }
    });
    return null;
  }
Tests merging configurations between existing and new stack values on
upgrade.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeHelperTest.java