public final class SortedMapSubject extends MapSubject
SortedMap
and NavigableMap
objects. This class supports assertions
based on NavigableMap
's API even if the subject only implements SortedMap
.MapSubject.UsingCorrespondence<A,E>
Modifier and Type | Method and Description |
---|---|
void |
hasFirstEntry(Object key,
Object value)
Fails if the map's first key/value pair is not equal to the given entry.
|
void |
hasFirstKey(Object key)
Fails if the map's first key is not equal to the given key.
|
void |
hasLastEntry(Object key,
Object value)
Fails if the map's last key/value pair is not equal to the given entry.
|
void |
hasLastKey(Object key)
Fails if the map's last key is not equal to the given key.
|
SortedMapSubject |
named(String format,
Object... args)
Adds a prefix to the subject, when it is displayed in error messages.
|
comparingValuesUsing, containsEntry, containsExactly, containsExactly, containsExactlyEntriesIn, containsKey, doesNotContainEntry, doesNotContainKey, hasSize, isEmpty, isEqualTo, isNotEmpty
actual, actualAsString, actualCustomStringRepresentation, check, check, equals, fail, fail, fail, failComparing, failComparing, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutSubject, failWithRawMessage, failWithRawMessageAndCause, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, toString
public SortedMapSubject named(String format, Object... args)
Subject
toString()
representation, e.g. boolean.
Writing assertThat(foo).named("foo").isTrue();
then results in a more reasonable error
message.
named()
takes a format template and argument objects which will be substituted into
the template using Strings.lenientFormat
.
Note this only supports the %s
specifier.
named
in class Subject<MapSubject,Map<?,?>>
format
- a template with %s
placeholdersargs
- the object parameters which will be applied to the message template.public void hasFirstKey(@NullableDecl Object key)
public void hasFirstEntry(@NullableDecl Object key, @NullableDecl Object value)
public void hasLastKey(@NullableDecl Object key)
Copyright © 2018. All rights reserved.