Java Examples for org.assertj.core.api.MapAssert
The following java examples will help you to understand the usage of org.assertj.core.api.MapAssert. These source code samples are taken from different open source projects.
Example 1
| Project: camunda-bpm-assert-master File: AbstractCaseAssert.java View source code |
protected S hasVars(String[] names) {
boolean shouldHaveVariables = names != null;
boolean shouldHaveSpecificVariables = names != null && names.length > 0;
Map<String, Object> vars = vars();
StringBuffer message = new StringBuffer();
message.append("Expecting %s to hold ");
message.append(shouldHaveVariables ? "case variables" + (shouldHaveSpecificVariables ? " %s, " : ", ") : "no variables at all, ");
message.append("instead we found it to hold " + (vars.isEmpty() ? "no variables at all." : "the variables %s."));
if (vars.isEmpty() && getCurrent() == null)
message.append(" (Please make sure you have set the history " + "service of the engine to at least 'audit' or a higher level " + "before making use of this assertion for historic instances!)");
MapAssert<String, Object> assertion = variables().overridingErrorMessage(message.toString(), toString(actual), shouldHaveSpecificVariables ? Arrays.asList(names) : vars.keySet(), vars.keySet());
if (shouldHaveVariables) {
if (shouldHaveSpecificVariables) {
assertion.containsKeys(names);
} else {
assertion.isNotEmpty();
}
} else {
assertion.isEmpty();
}
S self = (S) this;
return self;
}Example 2
| Project: assertj-core-master File: MapAssert_containsValues_Test.java View source code |
@Override
protected MapAssert<Object, Object> invoke_api_method() {
return assertions.containsValues("value1", "value2");
}Example 3
| Project: fabric8-master File: Assertions.java View source code |
public static MapAssert assertMap(Object value) { Map typedValue = asInstanceOf(value, Map.class); return (MapAssert) assertThat(typedValue); }