Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.test;
import org.elasticsearch.core.Nullable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
/**
* Builds a message describing how two sets of values are unequal.
*/
public class NotEqualMessageBuilder {
private final StringBuilder message;
private int indent = 0;
/**
* The name of the field being compared.
*/
public NotEqualMessageBuilder() {
this.message = new StringBuilder();
}
/**
* The failure message.
*/
@Override
public String toString() {
return message.toString();
}
/**
* Compare two maps.
*/
public void compareMaps(Map actual, Map expected) {
actual = new TreeMap<>(actual);
expected = new TreeMap<>(expected);
for (Map.Entry expectedEntry : expected.entrySet()) {
boolean hadKey = actual.containsKey(expectedEntry.getKey());
Object actualValue = actual.remove(expectedEntry.getKey());
compare(expectedEntry.getKey(), hadKey, actualValue, expectedEntry.getValue());
}
for (Map.Entry unmatchedEntry : actual.entrySet()) {
field(unmatchedEntry.getKey(), "unexpected but found [" + unmatchedEntry.getValue() + "]");
}
}
/**
* Compare two lists.
*/
public void compareLists(List