Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractMapAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, K, V>, ACTUAL extends Map<K, V>, K, V>

extends AbstractObjectAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, K, V>, ACTUAL extends Map<K, V>>
implements EnumerableAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, K, V>, Map.Entry<? extends K, ? extends V>>
Class Inheritance
All Implemented Interfaces
org.assertj.core.api.EnumerableAssert
Known Direct Subclasses
org.assertj.core.api.MapAssert
Type Parameters
<SELF>
the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
<ACTUAL>
the type of the "actual" value.
<K>
the type of keys in the map.
<V>
the type of values in the map.
Static Imports
java.util.Collections.singleton, .Objects.requireNonNull, java.util.stream.Collectors.toList, org.assertj.core.api.Assertions.assertThat, .Assertions.entry, org.assertj.core.description.Description.mostRelevantDescription, org.assertj.core.error.ShouldBeUnmodifiable.shouldBeUnmodifiable, org.assertj.core.extractor.Extractors.byName, .Extractors.extractedDescriptionOf, org.assertj.core.util.Arrays.array, .Arrays.isArray, .IterableUtil.toCollection

Base class for all implementations of assertions for Maps.
Authors
David DIDIER, Yvonne Wang, Alex Ruiz, Mikhail Mazursky, Nicolas François, dorzey, Filip Hrisafov

Field Summary

Modifier and TypeField and Description
pack-priv Maps

Constructor Summary

AccessConstructor and Description
protected
AbstractMapAssert(ACTUAL actual, Class<?> selfType)

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

this assertion object.
allSatisfy
(BiConsumer<? super K, ? super V>
the given requirements that each entry must satisfy.
entryRequirements
)

Verifies that all the actual map entries satisfy the given entryRequirements .

public SELF

Returns:

this assertion object.
anySatisfy
(BiConsumer<? super K, ? super V>
the given requirements that at least one entry must satisfy.
entryRequirements
)

Verifies that at least one map entry satisfies the given entryRequirements .

public SELF
as(String
the new description to set.
description
,
Object...
optional parameter if description is a format String.
args
)

Overrides org.assertj.core.api.AbstractObjectAssert.as.

Overrides default org.assertj.core.api.Descriptable.as.

Sets the description of the assertion that is going to be called after.
public SELF
as(Description
the new description to set.
description
)

Overrides org.assertj.core.api.AbstractObjectAssert.as.

Overrides default org.assertj.core.api.Descriptable.as.

Sets the description of the assertion that is going to be called after.
private void
public final SELF

Returns:

this assertion object.
contains
(Map.Entry<? extends K, ? extends V>...
the given entries.
entries
)

Verifies that the actual map contains the given entries, in any order.

public SELF

Returns:

this assertion object.
containsAllEntriesOf
(Map<? extends K, ? extends V>
the map with the given entries.
other
)

Verifies that the actual map contains all entries of the given map, in any order.

public final SELF

Returns:

this assertion object.
containsAnyOf
(Map.Entry<? extends K, ? extends V>...
the given entries.
entries
)

Verifies that the actual map contains at least one of the given entries.

protected SELF
containsAnyOfForProxy(Map.Entry<? extends K, ? extends V>[] entries)

public SELF

Returns:

this assertion object.
containsEntry
(K
the given key to check.
key
,
V
the given value to check.
value
)

Verifies that the actual map contains the given entry.

public final SELF

Returns:

this assertions object
containsExactly
(Map.Entry<? extends K, ? extends V>...
the given entries.
entries
)

Verifies that the actual map contains only the given entries and nothing else, in order.

public SELF

Returns:

this assertions object
containsExactlyEntriesOf
(Map<? extends K, ? extends V>
the given Map with the expected entries to be found in actual.
map
)

Same as containsExactly(Map.Entry[]) but handles the conversion of Map#entrySet() to array.

protected SELF
containsExactlyForProxy(Map.Entry<? extends K, ? extends V>[] entries)

public SELF

Returns:

this assertions object
containsExactlyInAnyOrderEntriesOf
(Map<? extends K, ? extends V>
the given Map with the expected entries to be found in actual.
map
)

Same as containsOnly(Map.Entry[]) but handles the conversion of Map#entrySet() to array.

protected SELF
containsForProxy(Map.Entry<? extends K, ? extends V>[] entries)

public SELF

Returns:

this assertions object
containsKey
(K
the given key
key
)

Verifies that the actual map contains the given key.

public final SELF

Returns:

this assertions object
containsKeys
(K...
the given keys
keys
)

Verifies that the actual map contains the given keys.

protected SELF
public final SELF

Returns:

this assertions object
containsOnly
(Map.Entry<? extends K, ? extends V>...
the entries that should be in the actual map.
entries
)

Verifies that the actual map contains only the given entries and nothing else, in any order.

protected SELF
containsOnlyForProxy(Map.Entry<? extends K, ? extends V>[] entries)

public final SELF

Returns:

this assertions object
containsOnlyKeys
(K...
the given keys that should be in the actual map.
keys
)

Verifies that the actual map contains only the given keys and nothing else, in any order.

public SELF

Returns:

this assertions object
containsOnlyKeys
(Iterable<? extends K>
the given keys that should be in the actual map.
keys
)

Verifies that the actual map contains only the given keys and nothing else, in any order.

protected SELF
public SELF

Returns:

this assertions object
containsValue
(V
the value to look for.
value
)

Verifies that the actual map contains the given value.

public final SELF

Returns:

this assertions object
containsValues
(V...
the values to look for in the actual map.
values
)

Verifies that the actual map contains the given values.

protected SELF
public SELF
describedAs(Description
the new description to set.
description
)

Overrides org.assertj.core.api.AbstractAssert.describedAs.

Implements org.assertj.core.api.Descriptable.describedAs.

Sets the description of the assertion that is going to be called after.
public SELF
describedAs(String
the new description to set.
description
,
Object...
optional parameter if description is a format String.
args
)

Overrides default org.assertj.core.api.Descriptable.describedAs.

Sets the description of the assertion that is going to be called after.
public final SELF

Returns:

this assertion object.
doesNotContain
(Map.Entry<? extends K, ? extends V>...
the given entries.
entries
)

Verifies that the actual map does not contain the given entries.

public SELF

Returns:

this assertion object.
doesNotContainEntry
(K
key of the entry.
key
,
V
value of the entry.
value
)

Verifies that the actual map does not contain the given entry.

protected SELF
doesNotContainForProxy(Map.Entry<? extends K, ? extends V>[] entries)

public SELF

Returns:

this assertions object
doesNotContainKey
(K
the given key
key
)

Verifies that the actual map does not contain the given key.

public final SELF

Returns:

this assertions object
doesNotContainKeys
(K...
the given keys
keys
)

Verifies that the actual map does not contain any of the given keys.

protected SELF
public SELF

Returns:

this assertions object
doesNotContainValue
(V
the value that should not be in actual map.
value
)

Verifies that the actual map does not contain the given value.

public SELF
doesNotHave(Condition<? super ACTUAL>
the given condition.
condition
)

Overrides org.assertj.core.api.AbstractAssert.doesNotHave.

Implements org.assertj.core.api.ExtensionPoints.doesNotHave.

Verifies that the actual value does not satisfy the given condition.
public SELF
doesNotHaveSameClassAs(Object
the object to check type against.
other
)

Overrides org.assertj.core.api.AbstractAssert.doesNotHaveSameClassAs.

Implements org.assertj.core.api.Assert.doesNotHaveSameClassAs.

Verifies that the actual value does not have the same class as the given object.
private void
public AbstractListAssert<?, List<?>, Object, ObjectAssert<Object>>

Returns:

a new assertion object whose object under test is the array containing the extracted map values
extracting
(Object...
the keys used to get values from the map under test
keys
)

Deprecated use extractingByKeys(Object[]) instead
Extract the values of given keys from the map under test into an array, this new array becoming the object under test.
public AbstractObjectAssert<?, ?>

Returns:

a new ObjectAssert instance whose object under test is the extracted map value
extracting
(Object
the key used to get value from the map under test
key
)

Deprecated use extractingByKey(Object) instead
Extract the value of given key from the map under test, the extracted value becoming the new object under test.
public AbstractObjectAssert<?, V>

Returns:

a new ObjectAssert instance whose object under test is the extracted map value
extractingByKey
(K
the key used to get value from the map under test
key
)

Extract the value of given key from the map under test, the extracted value becoming the new object under test.

public <
the type of the resulting Assert
ASSERT extends AbstractAssert<?, ?>
>
ASSERT

Returns:

a new narrowed Assert instance whose object under test is the extracted map value
extractingByKey
(K
the key used to get value from the map under test
key
,
InstanceOfAssertFactory<?, ASSERT>
the factory which verifies the type and creates the new Assert
assertFactory
)

Extract the value of given key from the map under test, the extracted value becoming the new object under test.

public final AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>>

Returns:

a new assertion object whose object under test is the array containing the extracted map values
extractingByKeys
(K...
the keys used to get values from the map under test
keys
)

Extract the values of given keys from the map under test into an array, this new array becoming the object under test.

protected AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>>
public AbstractListAssert<?, List<?>, Object, ObjectAssert<Object>>

Returns:

a new assertion object whose object under test is the list of values extracted
extractingFromEntries
(Function<? super Map.Entry<K, V>, Object>
the extractor function to extract a value from an entry of the Map under test.
extractor
)

Use the given Function to extract a value from the Map's entries.

public final AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>

Returns:

a new assertion object whose object under test is the list of Tuples containing the extracted values.
extractingFromEntries
(Function<? super Map.Entry<K, V>, Object>...
the extractor functions to extract values from an entry of the Map under test.
extractors
)

Use the given Functions to extract values from the Map's entries.

protected AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>
extractingFromEntriesForProxy(Function<? super Map.Entry<K, V>, Object>[] extractors)

public AbstractListAssert<?, List<?>, Object, ObjectAssert<Object>>

Returns:

a new assertion object whose object under test is the array containing the extracted flattened map values
flatExtracting
(String...
the keys used to get values from the map under test
keys
)

Flatten the values of the given keys from the actual map under test into a new array, this new array becoming the object under test.

private static List<Object>
flatten(Iterable<Object> collectionToFlatten)

public SELF
has(Condition<? super ACTUAL>
the given condition.
condition
)

Overrides org.assertj.core.api.AbstractAssert.has.

Implements org.assertj.core.api.ExtensionPoints.has.

Verifies that the actual value satisfies the given condition.
public SELF

Returns:

this assertion object.
hasEntrySatisfying
(K
he given key to check.
key
,
Condition<? super V>
the given condition for check value.
valueCondition
)

Verifies that the actual map contains a value for the given key that satisfies the given valueCondition.

public SELF

Returns:

this assertion object.
hasEntrySatisfying
(K
he given key to check.
key
,
Consumer<? super V>
the given requirements for check value.
valueRequirements
)

Verifies that the actual map contains the value for given key that satisfy given valueRequirements.

public SELF

Returns:

this assertion object.
hasEntrySatisfying
(Condition<? super Map.Entry<K, V>>
the condition for searching entry.
entryCondition
)

Verifies that the actual map contains an entry satisfying the given entryCondition.

public SELF

Returns:

this assertion object.
hasEntrySatisfying
(Condition<? super K>
the condition to be matched by the entry's key.
keyCondition
,
Condition<? super V>
the condition to be matched by the entry's value.
valueCondition
)

Verifies that the actual map contains an entry with a key satisfying the given keyCondition and a value satisfying the given valueCondition.

public SELF

Returns:

this assertion object.
hasKeySatisfying
(Condition<? super K>
the condition to be matched by the entry's key.
keyCondition
)

Verifies that the actual map contains an entry with a key satisfying the given keyCondition.

public SELF
hasSameClassAs(Object
the object to check type against.
other
)

Overrides org.assertj.core.api.AbstractAssert.hasSameClassAs.

Implements org.assertj.core.api.Assert.hasSameClassAs.

Verifies that the actual value has the same class as the given object.
public SELF

Returns:

this assertion object.
hasSameSizeAs
(Object
the array to compare size with actual group.
other
)

Implements org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Verifies that the actual map has the same size as the given array.
public SELF

Returns:

this assertion object.
hasSameSizeAs
(Iterable<?>
the Iterable to compare size with actual group.
other
)

Implements org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Verifies that the actual map has the same size as the given Iterable.
public SELF

Returns:

this assertion object
hasSameSizeAs
(Map<?, ?>
the Map to compare size with actual map
other
)

Verifies that the actual map has the same size as the given Map.

public SELF

Returns:

this assertion object.
hasSize
(int
the expected number of values in the Map.
expected
)

Implements org.assertj.core.api.EnumerableAssert.hasSize.

Verifies that the number of values in the Map is equal to the given one.
public SELF

Returns:

this assertion object.
hasSizeBetween
(int
the lower boundary compared to which actual size should be greater than or equal to.
lowerBoundary
,
int
the higher boundary compared to which actual size should be less than or equal to.
higherBoundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeBetween.

Verifies that the number of values in the Map is between the given boundaries (inclusive).
public SELF

Returns:

this assertion object.
hasSizeGreaterThan
(int
the given value to compare the size of actual to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeGreaterThan.

Verifies that the number of values in the Map is greater than the boundary.
public SELF

Returns:

this assertion object.
hasSizeGreaterThanOrEqualTo
(int
the given value to compare the size of actual to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeGreaterThanOrEqualTo.

Verifies that the number of values in the Map is greater than or equal to the boundary.
public SELF

Returns:

this assertion object.
hasSizeLessThan
(int
the given value to compare the size of actual to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeLessThan.

Verifies that the number of values in the Map is less than the boundary.
public SELF

Returns:

this assertion object.
hasSizeLessThanOrEqualTo
(int
the given value to compare the size of actual to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeLessThanOrEqualTo.

Verifies that the number of values in the Map is less than or equal to the boundary.
public SELF
hasToString(String
the expected String description of actual.
expectedToString
)

Overrides org.assertj.core.api.AbstractAssert.hasToString.

Implements org.assertj.core.api.Assert.hasToString.

Verifies that actual actual.toString() is equal to the given String.
public SELF

Returns:

this assertion object.
hasValueSatisfying
(Condition<? super V>
the condition to be matched by the entry's value.
valueCondition
)

Verifies that the actual map contains an entry with a value satisfying the given valueCondition.

private AbstractObjectAssert<?, V>
public SELF
is(Condition<? super ACTUAL>
the given condition.
condition
)

Overrides org.assertj.core.api.AbstractAssert.is.

Implements org.assertj.core.api.ExtensionPoints.is.

Verifies that the actual value satisfies the given condition.
public void
isEmpty()

Implements org.assertj.core.api.EnumerableAssert.isEmpty.

Verifies that the Map is empty.
public SELF
isEqualTo(Object
the given value to compare the actual value to.
expected
)

Overrides org.assertj.core.api.AbstractAssert.isEqualTo.

Implements org.assertj.core.api.Assert.isEqualTo.

Verifies that the actual value is equal to the given one.
public SELF
isExactlyInstanceOf(Class<?>
the type to check the actual value against.
type
)

Overrides org.assertj.core.api.AbstractAssert.isExactlyInstanceOf.

Implements org.assertj.core.api.Assert.isExactlyInstanceOf.

Verifies that the actual value is exactly an instance of the given type.
public SELF
isIn(Iterable<?>
the given iterable to search the actual value in.
values
)

Overrides org.assertj.core.api.AbstractAssert.isIn.

Implements org.assertj.core.api.Assert.isIn.

Verifies that the actual value is present in the given iterable.
public SELF
isIn(Object...
the given array to search the actual value in.
values
)

Overrides org.assertj.core.api.AbstractAssert.isIn.

Implements org.assertj.core.api.Assert.isIn.

Verifies that the actual value is present in the given array of values.
public SELF
isInstanceOf(Class<?>
the type to check the actual value against.
type
)

Overrides org.assertj.core.api.AbstractAssert.isInstanceOf.

Implements org.assertj.core.api.Assert.isInstanceOf.

Verifies that the actual value is an instance of the given type.
public SELF
isInstanceOfAny(Class<?>...
the types to check the actual value against.
types
)

Overrides org.assertj.core.api.AbstractAssert.isInstanceOfAny.

Implements org.assertj.core.api.Assert.isInstanceOfAny.

Verifies that the actual value is an instance of any of the given types.
public SELF
isNot(Condition<? super ACTUAL>
the given condition.
condition
)

Overrides org.assertj.core.api.AbstractAssert.isNot.

Implements org.assertj.core.api.ExtensionPoints.isNot.

Verifies that the actual value does not satisfy the given condition.
public SELF

Returns:

this assertion object.
isNotEmpty
()

Implements org.assertj.core.api.EnumerableAssert.isNotEmpty.

Verifies that the Map is not empty.
public SELF
isNotEqualTo(Object
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractAssert.isNotEqualTo.

Implements org.assertj.core.api.Assert.isNotEqualTo.

Verifies that the actual value is not equal to the given one.
public SELF
isNotExactlyInstanceOf(Class<?>
the type to check the actual value against.
type
)

Overrides org.assertj.core.api.AbstractAssert.isNotExactlyInstanceOf.

Implements org.assertj.core.api.Assert.isNotExactlyInstanceOf.

Verifies that the actual value is not exactly an instance of given type.
public SELF
isNotIn(Iterable<?>
the given iterable to search the actual value in.
values
)

Overrides org.assertj.core.api.AbstractAssert.isNotIn.

Implements org.assertj.core.api.Assert.isNotIn.

Verifies that the actual value is not present in the given iterable.
public SELF
isNotIn(Object...
the given array to search the actual value in.
values
)

Overrides org.assertj.core.api.AbstractAssert.isNotIn.

Implements org.assertj.core.api.Assert.isNotIn.

Verifies that the actual value is not present in the given array of values.
public SELF
isNotInstanceOf(Class<?>
the type to check the actual value against.
type
)

Overrides org.assertj.core.api.AbstractAssert.isNotInstanceOf.

Implements org.assertj.core.api.Assert.isNotInstanceOf.

Verifies that the actual value is not an instance of the given type.
public SELF
isNotInstanceOfAny(Class<?>...
the types to check the actual value against.
types
)

Overrides org.assertj.core.api.AbstractAssert.isNotInstanceOfAny.

Implements org.assertj.core.api.Assert.isNotInstanceOfAny.

Verifies that the actual value is not an instance of any of the given types.
public SELF
isNotNull()

Overrides org.assertj.core.api.AbstractAssert.isNotNull.

Implements org.assertj.core.api.Assert.isNotNull.

Verifies that the actual value is not null.
public SELF
isNotOfAnyClassIn(Class<?>...
the types to check the actual value against.
types
)

Overrides org.assertj.core.api.AbstractAssert.isNotOfAnyClassIn.

Implements org.assertj.core.api.Assert.isNotOfAnyClassIn.

Verifies that the actual value type is not in given types.
public SELF
isNotSameAs(Object
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractAssert.isNotSameAs.

Implements org.assertj.core.api.Assert.isNotSameAs.

Verifies that the actual value is not the same as the given one, i.e., using == comparison.
public void
isNullOrEmpty()

Implements org.assertj.core.api.EnumerableAssert.isNullOrEmpty.

Verifies that the Map is null or empty.
public SELF
isOfAnyClassIn(Class<?>...
the types to check the actual value against.
types
)

Overrides org.assertj.core.api.AbstractAssert.isOfAnyClassIn.

Implements org.assertj.core.api.Assert.isOfAnyClassIn.

Verifies that the actual value type is in given types.
public SELF
isSameAs(Object
the given value to compare the actual value to.
expected
)

Overrides org.assertj.core.api.AbstractAssert.isSameAs.

Implements org.assertj.core.api.Assert.isSameAs.

Verifies that the actual value is the same as the given one, i.e., using == comparison.
public SELF

Returns:

this assertion object.
isUnmodifiable
()

Verifies that the actual map is unmodifiable, i.e. throws an UnsupportedOperationException with any attempt to modify the map.

public SELF

Returns:

this assertion object.
noneSatisfy
(BiConsumer<? super K, ? super V>
the given requirements that each entry must not satisfy.
entryRequirements
)

Verifies that no map entry satisfies the given entryRequirements .

public SELF
overridingErrorMessage(String
the error message that will replace the default one provided by Assertj.
newErrorMessage
,
Object...
the args used to fill error message as in String#format(String, Object...).
args
)

Overrides org.assertj.core.api.AbstractAssert.overridingErrorMessage.

Overrides AssertJ default error message by the given one.
public AbstractMapSizeAssert<SELF, ACTUAL, K, V>

Returns:

a AbstractMapSizeAssert to allow assertions on the number of key-value mappings in this map
size
()

Returns an Assert object that allows performing assertions on the size of the Map under test.

private Map.Entry<? extends K, ? extends V>[]
toEntries(Map<? extends K, ? extends V> map)

public SELF
usingComparator(Comparator<? super ACTUAL>
the comparator to use for the incoming assertion checks.
customComparator
)

Overrides org.assertj.core.api.AbstractAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
public SELF
usingComparator(Comparator<? super ACTUAL>
the comparator to use for the incoming assertion checks.
customComparator
,
String
comparator description to be used in assertion error messages
customComparatorDescription
)

Overrides org.assertj.core.api.AbstractAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
public SELF
usingDefaultComparator()

Overrides org.assertj.core.api.AbstractAssert.usingDefaultComparator.

Implements org.assertj.core.api.Assert.usingDefaultComparator.

Revert to standard comparison for the incoming assertion checks.
public SELF
usingDefaultElementComparator()

Implements org.assertj.core.api.EnumerableAssert.usingDefaultElementComparator.

Deprecated Custom element Comparator is not supported for MapEntry comparison.
Do not use this method.
public SELF
usingElementComparator(Comparator<? super Map.Entry<? extends K, ? extends V>>
the comparator to use for incoming assertion checks.
customComparator
)

Implements org.assertj.core.api.EnumerableAssert.usingElementComparator.

Deprecated Custom element Comparator is not supported for MapEntry comparison.
Do not use this method.
public RecursiveAssertionAssert

Returns:

A new instance of RecursiveAssertionAssert built with a default RecursiveAssertionConfiguration.
usingRecursiveAssertion
()

Overrides org.assertj.core.api.AbstractObjectAssert.usingRecursiveAssertion.

Asserts that the given predicate is met for all fields of the object under test recursively (but not the object itself).

public RecursiveAssertionAssert

Returns:

A new instance of RecursiveAssertionAssert built with a default RecursiveAssertionConfiguration.
usingRecursiveAssertion
(RecursiveAssertionConfiguration
The recursion configuration described above.
recursiveAssertionConfiguration
)

Overrides org.assertj.core.api.AbstractObjectAssert.usingRecursiveAssertion.

The same as usingRecursiveAssertion(), but this method allows the developer to pass in an explicit recursion configuration.

public RecursiveComparisonAssert<?>

Returns:

a new RecursiveComparisonAssert instance
usingRecursiveComparison
()

Overrides org.assertj.core.api.AbstractObjectAssert.usingRecursiveComparison.

Enable using a recursive field by field comparison strategy when calling the chained RecursiveComparisonAssert,

Example:

 public class Person {
  String name;
  boolean hasPhd;
}

public class Doctor {
 String name;
 boolean hasPhd;
}

Doctor drSheldon = new Doctor("Sheldon Cooper", true);
Doctor drLeonard = new Doctor("Leonard Hofstadter", true);
Doctor drRaj = new Doctor("Raj Koothrappali", true);

Person sheldon = new Person("Sheldon Cooper", true);
Person leonard = new Person("Leonard Hofstadter", true);
Person raj = new Person("Raj Koothrappali", true);

Map<String, Doctor> doctors = mapOf(entry(drSheldon.name, drSheldon),
                                          entry(drLeonard.name, drLeonard),
                                          entry(drRaj.name, drRaj));
Map<String, Person> people = mapOf(entry(sheldon.name, sheldon),
                                         entry(leonard.name, leonard),
                                         entry(raj.name, raj));

// assertion succeeds as both maps contains equivalent items.
public RecursiveComparisonAssert<?>
public AbstractCollectionAssert<?, Collection<? extends V>, V, ObjectAssert<V>>

Returns:

An AbstractCollectionAssert to make collections assertion only on map values.
values
()

Returns an AbstractCollectionAssert to make assertions on the values of the map

Example

 TolkienCharacter pippin = new TolkienCharacter("Pippin", 28, HOBBIT);
TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);
TolkienCharacter merry = new TolkienCharacter("Merry", 36, HOBBIT);

Map<String, TolkienCharacter> characters = mapOf(entry("Pippin", pippin),
                                                 entry("Frodo", frodo),
                                                 entry("Merry", merry));
assertThat(characters).values()
                      .contains(frodo, pippin, merry); 
public SELF
withFailMessage(String
the error message that will replace the default one provided by Assertj.
newErrorMessage
,
Object...
the args used to fill error message as in String#format(String, Object...).
args
)

Overrides org.assertj.core.api.AbstractAssert.withFailMessage.

Alternative method for AbstractAssert#overridingErrorMessage

You must set it before calling the assertion otherwise it is ignored as the failing assertion breaks the chained call by throwing an AssertionError.

public SELF
withThreadDumpOnError()

Overrides org.assertj.core.api.AbstractAssert.withThreadDumpOnError.

Implements org.assertj.core.api.Assert.withThreadDumpOnError.

In case of an assertion error, a thread dump will be printed to System#err.
Inherited from org.assertj.core.api.AbstractObjectAssert:
doesNotReturnextractingextractingextractingextractingextractingextractingextractingForProxygetComparatorsByTypehasAllNullFieldsOrPropertieshasAllNullFieldsOrPropertiesExcepthasFieldOrPropertyhasFieldOrPropertyWithValuehasNoNullFieldsOrPropertieshasNoNullFieldsOrPropertiesExcepthasOnlyFieldsisEqualToComparingFieldByFieldisEqualToComparingFieldByFieldRecursivelyisEqualToComparingOnlyGivenFieldsisEqualToIgnoringGivenFieldsisEqualToIgnoringNullFieldsnewObjectAssertreturnsusingComparatorForFieldsusingComparatorForTypewithAssertionStatewithComparatorByPropertyOrFieldwithTypeComparator