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

public Class BDDAssertions

extends Assertions
Class Inheritance
Annotations
@CheckReturnValue
Imports
java.io.File, .IOException, .InputStream, .UncheckedIOException, java.math.BigDecimal, .BigInteger, java.net.URI, .URL, java.nio.charset.Charset, java.nio.file.Path, java.text.DateFormat, java.time.Duration, .Instant, .LocalDate, .LocalDateTime, .LocalTime, .OffsetDateTime, .OffsetTime, .Period, .YearMonth, .ZonedDateTime, java.time.temporal.Temporal, .TemporalUnit, java.util.Collection, .Date, .Iterator, .List, .Map, .Optional, .OptionalDouble, .OptionalInt, .OptionalLong, .Spliterator, java.util.concurrent.CompletableFuture, .CompletionStage, .Future, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, .AtomicIntegerArray, .AtomicIntegerFieldUpdater, .AtomicLong, .AtomicLongArray, .AtomicLongFieldUpdater, .AtomicMarkableReference, .AtomicReference, .AtomicReferenceArray, .AtomicReferenceFieldUpdater, .AtomicStampedReference, .LongAdder, java.util.function.Consumer, .DoublePredicate, .Function, .IntPredicate, .LongPredicate, .Predicate, java.util.regex.Matcher, java.util.stream.DoubleStream, .IntStream, .LongStream, .Stream, org.assertj.core.api.ThrowableAssert.ThrowingCallable, org.assertj.core.api.filter.FilterOperator, .InFilter, .NotFilter, .NotInFilter, org.assertj.core.condition.AllOf, .AnyOf, .DoesNotHave, .Not, org.assertj.core.configuration.Configuration, org.assertj.core.data.Index, .MapEntry, .Offset, .Percentage, .TemporalUnitOffset, org.assertj.core.description.Description, org.assertj.core.groups.Properties, .Tuple, org.assertj.core.presentation.BinaryRepresentation, .HexadecimalRepresentation, .Representation, .StandardRepresentation, .UnicodeRepresentation, org.assertj.core.util.CanIgnoreReturnValue, .CheckReturnValue

Behavior-driven development style entry point for assertion methods for different types. Each method in this class is a static factory for a type-specific assertion object.

The difference with the Assertions class is that entry point methods are named then instead of assertThat.

For example:

 @Test
public void bdd_assertions_example() {
  //given
  List<BasketBallPlayer> bulls = new ArrayList<>();

  //when
  bulls.add(rose);
  bulls.add(noah);

  then(bulls).contains(rose, noah).doesNotContain(james);
}
Use and to avoid clash with other libraries (like BDDMockito) exposing 'then(object)'. You might have to ignore a warning like: The static method BDDAssertions.then() should be accessed in a static way.
Authors
Gonzalo Müller, Alex Ruiz, Yvonne Wang, David DIDIER, Ted Young, Joel Costigliola, Matthieu Baechler, Mikhail Mazursky, Nicolas François, Julien Meddah, William Delanoue, Mariusz Smykula

Field Summary

Modifier and TypeField and Description
public static final BDDAssertions
and

A BDDAssertions which allows to blend assertions with other libraries when the name 'then' cause clash.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static <
the type of object the given condition accept.
T
>
Condition<T>

Returns:

the created AllOf.
allOf
(Condition<? super T>...
the conditions to evaluate.
conditions
)

Hides org.assertj.core.api.Assertions.allOf.

Creates a new AllOf
public static <
the type of object the given condition accept.
T
>
Condition<T>

Returns:

the created AllOf.
allOf
(Iterable<? extends Condition<? super T>>
the conditions to evaluate.
conditions
)

Hides org.assertj.core.api.Assertions.allOf.

Creates a new AllOf
public static <
the type of object the given consumers accept
T
>
ThrowingConsumer<T>

Returns:

the ThrowingConsumer instance
allOf
(ThrowingConsumer<? super T>...
the consumers to evaluate
consumers
)

Hides org.assertj.core.api.Assertions.allOf.

Create a new ThrowingConsumer that delegates the evaluation of the given consumers to AbstractAssert#satisfies(ThrowingConsumer[]).
public static <
the type of object the given condition accept.
T
>
Condition<T>

Returns:

the created AnyOf.
anyOf
(Condition<? super T>...
the conditions to evaluate.
conditions
)

Hides org.assertj.core.api.Assertions.anyOf.

Only delegate to AnyOf#anyOf(Condition...) so that Assertions offers a full feature entry point to all AssertJ features (but you can use AnyOf if you prefer).
public static <
the type of object the given condition accept.
T
>
Condition<T>

Returns:

the created AnyOf.
anyOf
(Iterable<? extends Condition<? super T>>
the conditions to evaluate.
conditions
)

Hides org.assertj.core.api.Assertions.anyOf.

Creates a new AnyOf
public static <
the type of object the given consumers accept
T
>
ThrowingConsumer<T>

Returns:

the ThrowingConsumer instance
anyOf
(ThrowingConsumer<? super T>...
the consumers to evaluate
consumers
)

Hides org.assertj.core.api.Assertions.anyOf.

Create a new ThrowingConsumer that delegates the evaluation of the given consumers to AbstractAssert#satisfiesAnyOf(ThrowingConsumer[]).
public static <
the type to use for the cast.
T
,
the type of the resulting Assert
ASSERT extends AbstractAssert<?, ?>
>
InstanceOfAssertFactory<T, ASSERT>

Returns:

same instance of assertFactory
as
(InstanceOfAssertFactory<T, ASSERT>
the factory which verifies the type and creates the new Assert
assertFactory
)

Hides org.assertj.core.api.Assertions.as.

A syntax sugar to write fluent assertion with methods having an InstanceOfAssertFactory parameter.
public static Index

Returns:

the created Index.
atIndex
(int
the value of the index.
index
)

Hides org.assertj.core.api.Assertions.atIndex.

Only delegate to Index#atIndex(int) so that Assertions offers a full feature entry point to all AssertJ features (but you can use Index if you prefer).
public static Offset<Double>
public static Offset<Float>

Returns:

the created Offset.
byLessThan
(Float
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Alias for offset(Float) to use with isCloseTo assertions.
public static Offset<BigDecimal>

Returns:

the created Offset.
byLessThan
(BigDecimal
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for BigDecimal Offset to use with isCloseTo assertions.
public static Offset<BigInteger>

Returns:

the created Offset.
byLessThan
(BigInteger
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for BigInteger Offset to use with isCloseTo assertions.
public static Offset<Byte>

Returns:

the created Offset.
byLessThan
(Byte
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for Byte Offset to use with isCloseTo assertions.
public static Offset<Integer>

Returns:

the created Offset.
byLessThan
(Integer
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for Long Offset to use with strict isCloseTo assertions.
public static Offset<Short>

Returns:

the created Offset.
byLessThan
(Short
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for Short Offset to use with isCloseTo assertions.
public static Offset<Long>

Returns:

the created Offset.
byLessThan
(Long
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for Long Offset to use with strict isCloseTo assertions.
public static TemporalUnitOffset

Returns:

the created Offset.
byLessThan
(long
the value of the offset.
value
,
TemporalUnit
the TemporalUnit of the offset.
unit
)

Hides org.assertj.core.api.Assertions.byLessThan.

Assertions entry point for TemporalUnitOffset with strict less than condition to use with isCloseTo temporal assertions.
public static Exception

Returns:

The captured exception or null if none was raised by the callable.
catchException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchException.

Allows catching an instance of Exception.
public static IllegalArgumentException

Returns:

The captured exception or null if none was raised by the callable.
catchIllegalArgumentException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchIllegalArgumentException.

Allows catching an instance of IllegalArgumentException.
public static IllegalStateException

Returns:

The captured exception or null if none was raised by the callable.
catchIllegalStateException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchIllegalStateException.

Allows catching an instance of IllegalStateException.
public static IndexOutOfBoundsException

Returns:

The captured exception or null if none was raised by the callable.
catchIndexOutOfBoundsException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchIndexOutOfBoundsException.

Allows catching an instance of IndexOutOfBoundsException.
public static IOException

Returns:

The captured exception or null if none was raised by the callable.
catchIOException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchIOException.

Allows catching an instance of IOException.
public static NullPointerException

Returns:

The captured exception or null if none was raised by the callable.
catchNullPointerException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchNullPointerException.

Allows catching an instance of NullPointerException.
public static ReflectiveOperationException

Returns:

The captured exception or null if none was raised by the callable.
catchReflectiveOperationException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchReflectiveOperationException.

Allows catching an instance of ReflectiveOperationException.
public static RuntimeException

Returns:

The captured exception or null if none was raised by the callable.
catchRuntimeException
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchRuntimeException.

Allows catching an instance of RuntimeException.
public static Throwable

Returns:

The captured exception or null if none was raised by the callable.
catchThrowable
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchThrowable.

Allows catching a Throwable more easily when used with Java 8 lambdas.
public static <
the Throwable type.
THROWABLE extends Throwable
>
THROWABLE

Returns:

The captured exception or null if none was raised by the callable.
catchThrowableOfType
(ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
,
Class<THROWABLE>
The type of exception that the code is expected to raise.
type
)

Hides org.assertj.core.api.Assertions.catchThrowableOfType.

Allows catching a Throwable of a specific type.
public static <
the Throwable type.
THROWABLE extends Throwable
>
THROWABLE

Returns:

The captured exception or null if none was raised by the callable.
catchThrowableOfType
(Class<THROWABLE>
The type of exception that the code is expected to raise.
type
,
ThrowableAssert.ThrowingCallable
The lambda with the code that should raise the exception.
throwingCallable
)

Hides org.assertj.core.api.Assertions.catchThrowableOfType.

Allows catching a Throwable of a specific type.
public static String

Returns:

the content of the file.
contentOf
(File
the file.
file
,
Charset
the character set to use.
charset
)

Hides org.assertj.core.api.Assertions.contentOf.

Loads the text content of a file, so that it can be passed to assertThat(String).
public static String

Returns:

the content of the file.
contentOf
(File
the file.
file
,
String
the name of the character set to use.
charsetName
)

Hides org.assertj.core.api.Assertions.contentOf.

Loads the text content of a file, so that it can be passed to assertThat(String).
public static String

Returns:

the content of the file.
contentOf
(File
the file.
file
)

Hides org.assertj.core.api.Assertions.contentOf.

Loads the text content of a file with the default character set, so that it can be passed to assertThat(String).
public static String

Returns:

the content of the URL.
contentOf
(URL
the URL.
url
,
Charset
the character set to use.
charset
)

Hides org.assertj.core.api.Assertions.contentOf.

Loads the text content of a URL, so that it can be passed to assertThat(String).
public static String

Returns:

the content of the URL.
contentOf
(URL
the URL.
url
,
String
the name of the character set to use.
charsetName
)

Hides org.assertj.core.api.Assertions.contentOf.

Loads the text content of a URL, so that it can be passed to assertThat(String).
public static String

Returns:

the content of the file.
contentOf
(URL
the URL.
url
)

Hides org.assertj.core.api.Assertions.contentOf.

Loads the text content of a URL with the default character set, so that it can be passed to assertThat(String).
public static <
the type of object the given condition accept.
T
>
DoesNotHave<T>

Returns:

The DoesNotHave condition created.
doesNotHave
(Condition<? super T>
the condition to inverse.
condition
)

Hides org.assertj.core.api.Assertions.doesNotHave.

Creates a new DoesNotHave.
public static <
the type of keys in the map.
K
,
the type of values in the map.
V
>
MapEntry<K, V>

Returns:

the created MapEntry.
entry
(K
the key of the entry to create.
key
,
V
the value of the entry to create.
value
)

Hides org.assertj.core.api.Assertions.entry.

Only delegate to MapEntry#entry(Object, Object) so that Assertions offers a full feature entry point to all AssertJ features (but you can use MapEntry if you prefer).
public static <
the type of value to extract.
T
>
Properties<T>

Returns:

the created Properties.
extractProperty
(String
the name of the property to be read from the elements of a Iterable. It may be a nested property (e.g. "address.street.number").
propertyName
,
Class<T>
the type of property to extract
propertyType
)

Hides org.assertj.core.api.Assertions.extractProperty.

Only delegate to Properties#extractProperty(String) so that Assertions offers a full feature entry point to all AssertJ features (but you can use Properties if you prefer).
public static Properties<Object>

Returns:

the created Properties.
extractProperty
(String
the name of the property to be read from the elements of a Iterable. It may be a nested property (e.g. "address.street.number").
propertyName
)

Hides org.assertj.core.api.Assertions.extractProperty.

Only delegate to Properties#extractProperty(String) so that Assertions offers a full feature entry point to all AssertJ features (but you can use Properties if you prefer).
public static <
dummy return value type
T
>
T

Returns:

nothing, it's just to be used in doSomething(optional.orElseGet(() -> fail("boom")));.
fail
(String
error message.
failureMessage
)

Hides org.assertj.core.api.Assertions.fail.

Throws an AssertionError with the given message.
public static <
dummy return value type
T
>
T

Returns:

nothing, it's just to be used in doSomething(optional.orElseGet(() -> fail()));.
fail
()

Hides org.assertj.core.api.Assertions.fail.

Throws an AssertionError with an empty message to be used in code like:
 doSomething(optional.orElseGet(() -> fail()));
public static <
dummy return value type
T
>
T

Returns:

nothing, it's just to be used in doSomething(optional.orElseGet(() -> fail("b%s", ""oom)));.
fail
(String
error message.
failureMessage
,
Object...
Arguments referenced by the format specifiers in the format string.
args
)

Hides org.assertj.core.api.Assertions.fail.

Throws an AssertionError with the given message built as String#format(String, Object...).
public static <
dummy return value type
T
>
T

Returns:

nothing, it's just to be used in doSomething(optional.orElseGet(() -> fail("boom", cause)));.
fail
(String
the description of the failed assertion. It can be null.
failureMessage
,
Throwable
cause of the error.
realCause
)

Hides org.assertj.core.api.Assertions.fail.

Throws an AssertionError with the given message and with the Throwable that caused the failure.
public static <
dummy return value type
T
>
T

Returns:

nothing, it's just to be used in doSomething(optional.orElseGet(() -> fail(cause)));.
fail
(Throwable
cause of the error.
realCause
)

Hides org.assertj.core.api.Assertions.fail.

Throws an AssertionError with the Throwable that caused the failure.
public static <
Type of test subject
F
,
Type of the property under the assertion
T
>
Function<F, T>

Returns:

same instance of extractor
from
(Function<F, T>
A function to extract test subject's property
extractor
)

Hides org.assertj.core.api.Assertions.from.

A syntax sugar to write fluent assertion using ObjectAssert#returns(Object, Function) and ObjectAssert#doesNotReturn(Object, Function).
public static InFilter

Returns:

the created "in" filter
in
(Object...
values to match (one match is sufficient)
values
)

Hides org.assertj.core.api.Assertions.in.

Create a FilterOperator to use in filteredOn(String, FilterOperation) to express a filter keeping all Iterable elements whose property/field value matches one of the given values.
public static List<String>

Returns:

the content of the file.
linesOf
(File
the file.
file
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a file into a list of strings with the default charset, each string corresponding to a line.
public static List<String>

Returns:

the content of the file.
linesOf
(File
the file.
file
,
Charset
the character set to use.
charset
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a file into a list of strings, each string corresponding to a line.
public static List<String>

Returns:

the content of the file.
linesOf
(File
the file.
file
,
String
the name of the character set to use.
charsetName
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a file into a list of strings, each string corresponding to a line.
public static List<String>

Returns:

the content of the file at the given path.
linesOf
(Path
the path.
path
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a file at a given path into a list of strings with the default charset, each string corresponding to a line.
public static List<String>

Returns:

the content of the file at the given path.
linesOf
(Path
the path.
path
,
Charset
the character set to use.
charset
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a file at a given path into a list of strings, each string corresponding to a line.
public static List<String>

Returns:

the content of the file at the given path.
linesOf
(Path
the path.
path
,
String
the name of the character set to use.
charsetName
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a file at a given path into a list of strings, each string corresponding to a line.
public static List<String>

Returns:

the content of the file.
linesOf
(URL
the URL.
url
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a URL into a list of strings with the default charset, each string corresponding to a line.
public static List<String>

Returns:

the content of the file.
linesOf
(URL
the URL.
url
,
Charset
the character set to use.
charset
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a URL into a list of strings, each string corresponding to a line.
public static List<String>

Returns:

the content of the file.
linesOf
(URL
the URL.
url
,
String
the name of the character set to use.
charsetName
)

Hides org.assertj.core.api.Assertions.linesOf.

Loads the text content of a URL into a list of strings, each string corresponding to a line.
public static <
the type of object the given condition accept.
T
>
Not<T>

Returns:

The Not condition created.
not
(Condition<? super T>
the condition to inverse.
condition
)

Hides org.assertj.core.api.Assertions.not.

Creates a new Not.
public static NotFilter

Returns:

the created "not" filter
not
(Object
the value not to match
valueNotToMatch
)

Hides org.assertj.core.api.Assertions.not.

Create a FilterOperator to use in filteredOn(String, FilterOperation) to express a filter keeping all Iterable elements whose property/field value matches does not match the given value.
public static NotInFilter

Returns:

the created "not in" filter
notIn
(Object...
values not to match (none of the values must match)
valuesNotToMatch
)

Hides org.assertj.core.api.Assertions.notIn.

Create a FilterOperator to use in filteredOn(String, FilterOperation) to express a filter keeping all Iterable elements whose property/field value matches does not match any of the given values.
public static void
registerCustomDateFormat(DateFormat
the new Date format used for String based Date assertions.
userCustomDateFormat
)

Hides org.assertj.core.api.Assertions.registerCustomDateFormat.

Add the given date format to the ones used to parse date String in String based Date assertions like org.assertj.core.api.AbstractDateAssert#isEqualTo(String).
public static void
registerCustomDateFormat(String
the new Date format pattern used for String based Date assertions.
userCustomDateFormatPattern
)

Hides org.assertj.core.api.Assertions.registerCustomDateFormat.

Add the given date format to the ones used to parse date String in String based Date assertions like org.assertj.core.api.AbstractDateAssert#isEqualTo(String).
public static <
the type of format.
T
>
void
registerFormatterForType(Class<T>
the class of the type to format
type
,
Function<T, String>
the formatter Function
formatter
)

Hides org.assertj.core.api.Assertions.registerFormatterForType.

Assertions error messages uses a Representation to format the different types involved, using this method you can control the formatting of a given type by providing a specific formatter.
public static void
setAllowComparingPrivateFields(boolean
allow private fields comparison. Default is true.
allowComparingPrivateFields
)

Hides org.assertj.core.api.Assertions.setAllowComparingPrivateFields.

Globally sets whether the use of private fields is allowed for comparison.
public static void
setAllowExtractingPrivateFields(boolean
allow private fields extraction. Default is true.
allowExtractingPrivateFields
)

Hides org.assertj.core.api.Assertions.setAllowExtractingPrivateFields.

Globally sets whether IterableAssert#extracting(String) and ObjectArrayAssert#extracting(String) should be allowed to extract private fields, if not and they try it fails with exception.
public static void
setDescriptionConsumer(Consumer<Description>
the Description consumer
descriptionConsumer
)

Hides org.assertj.core.api.Assertions.setDescriptionConsumer.

All assertions description will be consumed by the given Consumer<Description> allowing for example to record them in a file.
public static void
setExtractBareNamePropertyMethods(boolean
whether bare-named property methods are found
barenamePropertyMethods
)

Hides org.assertj.core.api.Assertions.setExtractBareNamePropertyMethods.

Globally sets whether the extractor considers bare-named property methods like String name().
public static void
setLenientDateParsing(boolean
whether lenient parsing mode should be enabled or not
value
)

Hides org.assertj.core.api.Assertions.setLenientDateParsing.

Instead of using default strict date/time parsing, it is possible to use lenient parsing mode for default date formats parser to interpret inputs that do not precisely match supported date formats (lenient parsing).
public static void
setMaxElementsForPrinting(int
the maximum elements that would be printed for iterables, arrays and maps.
maxElementsForPrinting
)

Hides org.assertj.core.api.Assertions.setMaxElementsForPrinting.

Sets the maximum number of elements to display in error messages for iterables, arrays and map .
public static void
setMaxLengthForSingleLineDescription(int
the maximum length for an iterable/array to be displayed on one line
maxLengthForSingleLineDescription
)

Hides org.assertj.core.api.Assertions.setMaxLengthForSingleLineDescription.

In error messages, sets the threshold when iterable/array formatting will be on one line (if their String description length <= this parameter) or it will be formatted with one element per line.
public static void
setMaxStackTraceElementsDisplayed(int
the maximum number of lines for a stacktrace to be displayed on one throw.
maxStackTraceElementsDisplayed
)

Hides org.assertj.core.api.Assertions.setMaxStackTraceElementsDisplayed.

Sets how many stacktrace elements are included in Throwable representation (by default this set to 3).
public static void
setPrintAssertionsDescription(boolean
whether to print assertions description.
printAssertionsDescription
)

Hides org.assertj.core.api.Assertions.setPrintAssertionsDescription.

Enable/disable printing assertions description to the console (disabled by default).
public static void
setRemoveAssertJRelatedElementsFromStackTrace(boolean
flag.
removeAssertJRelatedElementsFromStackTrace
)

Hides org.assertj.core.api.Assertions.setRemoveAssertJRelatedElementsFromStackTrace.

Sets whether we remove elements related to AssertJ from assertion error stack trace.
public static <
dummy return value type
T
>
T

Returns:

nothing, it's just to be used in doSomething(optional.orElseGet(() -> shouldHaveThrown(IOException.class)));.
shouldHaveThrown
(Class<? extends Throwable>
the Throwable class that was expected to be thrown.
throwableClass
)

Hides org.assertj.core.api.Assertions.shouldHaveThrown.

Throws an AssertionError with a message explaining that a Throwable of given class was expected to be thrown but had not been.
public static <
the type of the value contained in the Predicate.
T
>
PredicateAssert<T>

Returns:

the created assertion object.
then
(Predicate<T>
the actual value.
actual
)

Create assertion for Predicate.

public static IntPredicateAssert

Returns:

the created assertion object.
then
(IntPredicate
the actual value.
actual
)

Create assertion for IntPredicate.

public static LongPredicateAssert

Returns:

the created assertion object.
then
(LongPredicate
the actual value.
actual
)

Create assertion for LongPredicate.

public static DoublePredicateAssert

Returns:

the created assertion object.
then
(DoublePredicate
the actual value.
actual
)

Create assertion for DoublePredicate.

public static <
the type of the value contained in the java.util.Optional.
VALUE
>
OptionalAssert<VALUE>

Returns:

the created assertion object.
then
(Optional<VALUE>
the actual value.
optional
)

Create assertion for java.util.Optional.

public static OptionalIntAssert

Returns:

the created assertion object.
then
(OptionalInt
the actual value.
optional
)

Create assertion for java.util.OptionalInt.

public static OptionalLongAssert

Returns:

the created assertion object.
then
(OptionalLong
the actual value.
optional
)

Create assertion for java.util.OptionalLong.

public static MatcherAssert

Returns:

the created assertion object.
then
(Matcher
the actual matcher
actual
)

Create assertion for java.util.regex.Matcher

public static OptionalDoubleAssert

Returns:

the created assertion object.
then
(OptionalDouble
the actual value.
optional
)

Create assertion for java.util.OptionalDouble.

public static AbstractBigDecimalAssert<?>

Returns:

the created assertion object.
then
(BigDecimal
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.BigDecimalAssert.

public static AbstractBigIntegerAssert<?>

Returns:

the created assertion object.
then
(BigInteger
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.BigIntegerAssert.

public static AbstractBooleanAssert<?>

Returns:

the created assertion object.
then
(boolean
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.BooleanAssert.

public static AbstractBooleanAssert<?>

Returns:

the created assertion object.
then
(Boolean
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.BooleanAssert.

public static AbstractBooleanArrayAssert<?>

Returns:

the created assertion object.
then
(boolean[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.BooleanArrayAssert.

public static Boolean2DArrayAssert

Returns:

the created assertion object.
then
(boolean[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Boolean2DArrayAssert.

public static AbstractByteAssert<?>

Returns:

the created assertion object.
then
(byte
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ByteAssert.

public static AbstractByteAssert<?>

Returns:

the created assertion object.
then
(Byte
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ByteAssert.

public static AbstractByteArrayAssert<?>

Returns:

the created assertion object.
then
(byte[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ByteArrayAssert.

public static Byte2DArrayAssert

Returns:

the created assertion object.
then
(byte[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Byte2DArrayAssert.

public static AbstractCharacterAssert<?>

Returns:

the created assertion object.
then
(char
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharacterAssert.

public static AbstractCharArrayAssert<?>

Returns:

the created assertion object.
then
(char[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharArrayAssert.

public static Char2DArrayAssert

Returns:

the created assertion object.
then
(char[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Char2DArrayAssert.

public static AbstractCharacterAssert<?>

Returns:

the created assertion object.
then
(Character
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharacterAssert.

public static ClassAssert

Returns:

the created assertion object.
then
(Class<?>
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ClassAssert.

public static <
the actual type
T extends Comparable<? super T>
>
AbstractComparableAssert<?, T>

Returns:

the created assertion object.
then
(T
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.GenericComparableAssert with standard comparison semantics.

public static <
the actual elements type
T
>
IterableAssert<T>

Returns:

the created assertion object.
then
(Iterable<? extends T>
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.IterableAssert.

public static <
the actual elements type
T
>
IteratorAssert<T>

Returns:

the created assertion object.
then
(Iterator<? extends T>
the actual value.
actual
)

Creates a new instance of IteratorAssert.

public static <
The actual type
ACTUAL extends Iterable<? extends ELEMENT>
,
The actual elements type
ELEMENT
,
The actual elements AbstractAssert type
ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>
>
FactoryBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT>

Returns:

the created assertion object.
then
(Iterable<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

Deprecated This was added to help creating type-specific assertions for the elements of an Iterable instance.
Creates a new instance of FactoryBasedNavigableIterableAssert allowing to navigate to any Iterable element in order to perform assertions on it.
public static <
The actual type
ACTUAL extends Iterable<? extends ELEMENT>
,
The actual elements type
ELEMENT
,
The actual elements AbstractAssert type
ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>
>
ClassBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT>

Returns:

the created assertion object.
then
(ACTUAL
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

Deprecated This was added to help creating type-specific assertions for the elements of an Iterable instance.
Creates a new instance of ClassBasedNavigableIterableAssert allowing to navigate to any Iterable element in order to perform assertions on it.
public static <
The actual type
ACTUAL extends List<? extends ELEMENT>
,
The actual elements type
ELEMENT
,
The actual elements AbstractAssert type
ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>
>
FactoryBasedNavigableListAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT>

Returns:

the created assertion object.
then
(List<? extends ELEMENT>
the actual value.
actual
,
AssertFactory<ELEMENT, ELEMENT_ASSERT>
the factory used to create the elements assert instance.
assertFactory
)

Deprecated This was added to help creating type-specific assertions for the elements of an List instance.
Creates a new instance of FactoryBasedNavigableListAssert allowing to navigate to any List element in order to perform assertions on it.
public static <
The actual elements type
ELEMENT
,
The actual type
ACTUAL extends List<? extends ELEMENT>
,
The actual elements AbstractAssert type
ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>
>
ClassBasedNavigableListAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT>

Returns:

the created assertion object.
then
(List<? extends ELEMENT>
the actual value.
actual
,
Class<ELEMENT_ASSERT>
the class used to create the elements assert instance.
assertClass
)

Deprecated This was added to help creating type-specific assertions for the elements of an Iterable instance.
Creates a new instance of ClassBasedNavigableListAssert allowing to navigate to any List element in order to perform assertions on it.
public static AbstractDoubleAssert<?>

Returns:

the created assertion object.
then
(double
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.DoubleAssert.

public static AbstractDoubleAssert<?>

Returns:

the created assertion object.
then
(Double
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.DoubleAssert.

public static AbstractDoubleArrayAssert<?>

Returns:

the created assertion object.
then
(double[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.DoubleArrayAssert.

public static Double2DArrayAssert

Returns:

the created assertion object.
then
(double[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Double2DArrayAssert.

public static AbstractFileAssert<?>

Returns:

the created assertion object.
then
(File
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.FileAssert.

public static AbstractPathAssert<?>

Returns:

the created assertion object
then
(Path
the path to test
actual
)

Creates a new instance of PathAssert

public static <
the type of the value contained in the java.util.concurrent.Future.
RESULT
>
FutureAssert<RESULT>

Returns:

the created assertion object
then
(Future<RESULT>
the future to test
actual
)

Creates a new instance of FutureAssert

public static AbstractInputStreamAssert<?, ? extends InputStream>

Returns:

the created assertion object.
then
(InputStream
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.InputStreamAssert.

public static AbstractFloatAssert<?>

Returns:

the created assertion object.
then
(float
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.FloatAssert.

public static AbstractFloatAssert<?>

Returns:

the created assertion object.
then
(Float
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.FloatAssert.

public static AbstractFloatArrayAssert<?>

Returns:

the created assertion object.
then
(float[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.FloatArrayAssert.

public static Float2DArrayAssert

Returns:

the created assertion object.
then
(float[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Float2DArrayAssert.

public static AbstractIntegerAssert<?>

Returns:

the created assertion object.
then
(int
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.IntegerAssert.

public static AbstractIntArrayAssert<?>

Returns:

the created assertion object.
then
(int[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.IntArrayAssert.

public static Int2DArrayAssert

Returns:

the created assertion object.
then
(int[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Int2DArrayAssert.

public static AbstractIntegerAssert<?>

Returns:

the created assertion object.
then
(Integer
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.IntegerAssert.

public static <
the type of elements.
E
>
AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>>

Returns:

the created assertion object.
then
(Collection<? extends E>
the actual value.
actual
)

Creates a new instance of CollectionAssert.

public static <
the type of elements.
T
>
ListAssert<T>

Returns:

the created assertion object.
then
(List<? extends T>
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ListAssert.

public static AbstractLongAssert<?>

Returns:

the created assertion object.
then
(long
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.LongAssert.

public static AbstractLongAssert<?>

Returns:

the created assertion object.
then
(Long
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.LongAssert.

public static AbstractLongArrayAssert<?>

Returns:

the created assertion object.
then
(long[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.LongArrayAssert.

public static Long2DArrayAssert

Returns:

the created assertion object.
then
(long[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Long2DArrayAssert.

public static <
the type of the actual value.
T
>
ObjectAssert<T>

Returns:

the created assertion object.
then
(T
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ObjectAssert.

public static <
the actual's elements type.
T
>
ObjectArrayAssert<T>

Returns:

the created assertion object.
then
(T[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ObjectArrayAssert.

public static <
the actual's elements type.
T
>
Object2DArrayAssert<T>

Returns:

the created assertion object.
then
(T[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Object2DArrayAssert.

public static <
the type of keys in the map.
K
,
the type of values in the map.
V
>
MapAssert<K, V>

Returns:

the created assertion object.
then
(Map<K, V>
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.MapAssert.

public static AbstractShortAssert<?>

Returns:

the created assertion object.
then
(short
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ShortAssert.

public static AbstractShortAssert<?>

Returns:

the created assertion object.
then
(Short
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ShortAssert.

public static AbstractShortArrayAssert<?>

Returns:

the created assertion object.
then
(short[]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ShortArrayAssert.

public static Short2DArrayAssert

Returns:

the created assertion object.
then
(short[][]
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.Short2DArrayAssert.

public static AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assertion object.
then
(CharSequence
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharSequenceAssert.

public static AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assertion object.
then
(StringBuilder
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharSequenceAssert from a StringBuilder.

public static AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assertion object.
then
(StringBuffer
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharSequenceAssert from a StringBuffer.

public static AbstractStringAssert<?>

Returns:

the created assertion object.
then
(String
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.StringAssert.

public static AbstractDateAssert<?>

Returns:

the created assertion object.
then
(Date
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.DateAssert.

public static AtomicBooleanAssert

Returns:

the created assertion object.
then
(AtomicBoolean
the actual value.
actual
)

Create assertion for AtomicBoolean.

public static AtomicIntegerAssert

Returns:

the created assertion object.
then
(AtomicInteger
the actual value.
actual
)

Create assertion for AtomicInteger.

public static AtomicIntegerArrayAssert

Returns:

the created assertion object.
then
(AtomicIntegerArray
the actual value.
actual
)

Create assertion for AtomicIntegerArray.

public static <
the type of the object holding the updatable field.
OBJECT
>
AtomicIntegerFieldUpdaterAssert<OBJECT>

Returns:

the created assertion object.
then
(AtomicIntegerFieldUpdater<OBJECT>
the actual value.
actual
)

Create assertion for AtomicIntegerFieldUpdater.

public static LongAdderAssert

Returns:

the created assertion object.
then
(LongAdder
the actual value.
actual
)

Create assertion for LongAdder.

public static AtomicLongAssert

Returns:

the created assertion object.
then
(AtomicLong
the actual value.
actual
)

Create assertion for AtomicLong.

public static AtomicLongArrayAssert

Returns:

the created assertion object.
then
(AtomicLongArray
the actual value.
actual
)

Create assertion for AtomicLongArray.

public static <
the type of the object holding the updatable field.
OBJECT
>
AtomicLongFieldUpdaterAssert<OBJECT>

Returns:

the created assertion object.
then
(AtomicLongFieldUpdater<OBJECT>
the actual value.
actual
)

Create assertion for AtomicLongFieldUpdater.

public static <
the type of the value contained in the AtomicReference.
VALUE
>
AtomicReferenceAssert<VALUE>

Returns:

the created assertion object.
then
(AtomicReference<VALUE>
the actual value.
actual
)

Create assertion for AtomicReference.

public static <
the type of the value contained in the AtomicReferenceArray.
ELEMENT
>
AtomicReferenceArrayAssert<ELEMENT>

Returns:

the created assertion object.
then
(AtomicReferenceArray<ELEMENT>
the actual value.
actual
)

Create assertion for AtomicReferenceArray.

public static <
the type of the field which gets updated by the AtomicReferenceFieldUpdater.
FIELD
,
the type of the object holding the updatable field.
OBJECT
>
AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT>

Returns:

the created assertion object.
then
(AtomicReferenceFieldUpdater<OBJECT, FIELD>
the actual value.
actual
)

Create assertion for AtomicReferenceFieldUpdater.

public static <
the type of the value contained in the AtomicMarkableReference.
VALUE
>
AtomicMarkableReferenceAssert<VALUE>

Returns:

the created assertion object.
then
(AtomicMarkableReference<VALUE>
the actual value.
actual
)

Create assertion for AtomicMarkableReference.

public static <
the type of the value contained in the AtomicStampedReference.
VALUE
>
AtomicStampedReferenceAssert<VALUE>

Returns:

the created assertion object.
then
(AtomicStampedReference<VALUE>
the actual value.
actual
)

Create assertion for AtomicStampedReference.

public static <
the type of the actual throwable.
T extends Throwable
>
AbstractThrowableAssert<?, T>

Returns:

the created assertion Throwable.
then
(T
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ThrowableAssert.

public static TemporalAssert

Returns:

the created assertion object.
then
(Temporal
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.TemporalAssert.

public static AbstractLocalDateAssert<?>

Returns:

the created assertion object.
then
(LocalDate
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.LocalDateAssert.

public static AbstractYearMonthAssert<?>

Returns:

the created assertion object.
then
(YearMonth
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.YearMonthAssert.

public static AbstractLocalDateTimeAssert<?>

Returns:

the created assertion object.
then
(LocalDateTime
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.LocalDateTimeAssert.

public static AbstractZonedDateTimeAssert<?>

Returns:

the created assertion object.
then
(ZonedDateTime
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ZonedDateTimeAssert.

public static AbstractLocalTimeAssert<?>

Returns:

the created assertion object.
then
(LocalTime
the actual value.
actual
)

Creates a new instance of LocalTimeAssert.

public static AbstractOffsetTimeAssert<?>

Returns:

the created assertion object.
then
(OffsetTime
the actual value.
actual
)

Creates a new instance of OffsetTimeAssert.

public static AbstractInstantAssert<?>

Returns:

the created assertion object.
then
(Instant
the actual value.
actual
)

Creates a new instance of InstantAssert.

public static AbstractDurationAssert<?>

Returns:

the created assertion object.
then
(Duration
the actual value.
actual
)

Creates a new instance of DurationAssert.

public static AbstractPeriodAssert<?>

Returns:

the created assertion object.
then
(Period
the actual value.
actual
)

Creates a new instance of PeriodAssert.

public static AbstractUriAssert<?>

Returns:

the created assertion object.
then
(URI
the actual value.
actual
)

Creates a new instance of UriAssert.

public static AbstractUrlAssert<?>

Returns:

the created assertion object.
then
(URL
the actual value.
actual
)

Creates a new instance of UrlAssert.

public static AbstractOffsetDateTimeAssert<?>

Returns:

the created assertion object.
then
(OffsetDateTime
the actual value.
actual
)

Creates a new instance of OffsetTimeAssert.

public static <
the type of the value contained in the java.util.concurrent.CompletableFuture.
RESULT
>
CompletableFutureAssert<RESULT>

Returns:

the created assertion object.
then
(CompletableFuture<RESULT>
the actual value.
future
)

Create assertion for java.util.concurrent.CompletableFuture.

public static <
the type of the value contained in the java.util.concurrent.CompletionStage.
RESULT
>
CompletableFutureAssert<RESULT>

Returns:

the created assertion object.
then
(CompletionStage<RESULT>
the actual value.
actual
)

Create assertion for java.util.concurrent.CompletionStage by converting it to a CompletableFuture and returning a CompletableFutureAssert.

public static <
the generic type of the user-defined assert.
T extends AssertDelegateTarget
>
T

Returns:

the given assertion.
then
(T
the assertion to return.
assertion
)

Returns the given assertion.

public static <
the AssertProvider wrapped type.
T
>
T

Returns:

the associated Assert of the given component
then
(final AssertProvider<T>
the component that creates its own assert
component
)

Delegates the creation of the Assert to the AssertProvider#assertThat() of the given component.

public static <
the type of elements.
ELEMENT
>
ListAssert<ELEMENT>

Returns:

the created assertion object.
then
(Stream<? extends ELEMENT>
the actual Stream value.
actual
)

Creates a new instance of ListAssert from the given Stream.

public static ListAssert<Double>

Returns:

the created assertion object.
then
(DoubleStream
the actual DoubleStream value.
actual
)

Creates a new instance of ListAssert from the given DoubleStream.

public static ListAssert<Long>

Returns:

the created assertion object.
then
(LongStream
the actual LongStream value.
actual
)

Creates a new instance of ListAssert from the given LongStream.

public static ListAssert<Integer>

Returns:

the created assertion object.
then
(IntStream
the actual IntStream value.
actual
)

Creates a new instance of ListAssert from the given IntStream.

public static <
the type of elements.
ELEMENT
>
SpliteratorAssert<ELEMENT>

Returns:

the created assertion object.
then
(Spliterator<ELEMENT>
the spliterator to test.
actual
)

Creates a new instance of SpliteratorAssert from the given Spliterator.

public static AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assertion object.
thenCharSequence
(CharSequence
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.CharSequenceAssert.

public static AbstractThrowableAssert<?, ? extends Throwable>

Returns:

The captured exception or null if none was raised by the callable.
thenCode
(ThrowableAssert.ThrowingCallable
The ThrowingCallable or lambda with the code that should raise the throwable.
shouldRaiseOrNotThrowable
)

Allows to capture and then assert on a Throwable more easily when used with Java 8 lambdas.

public static <
the type of elements.
E
>
AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>>

Returns:

the created assertion object.
thenCollection
(Collection<? extends E>
the actual value.
actual
)

Creates a new instance of CollectionAssert.

public static <
the type of actual.
T
>
AbstractUniversalComparableAssert<?, T>

Returns:

the created assertion object.
thenComparable
(Comparable<T>
the actual value.
actual
)

Creates a new instance of UniversalComparableAssert with standard comparison semantics.

public static ThrowableTypeAssert<Exception>
public static <
the exception type.
T extends Throwable
>
ThrowableTypeAssert<T>

Returns:

the created ThrowableTypeAssert.
thenExceptionOfType
(final Class<? extends T>
the exception type class.
exceptionType
)

Entry point to check that an exception of type T is thrown by a given throwingCallable which allows to chain assertions on the thrown exception.

public static ThrowableTypeAssert<IllegalArgumentException>
public static ThrowableTypeAssert<IllegalStateException>
public static ThrowableTypeAssert<IndexOutOfBoundsException>
public static ThrowableTypeAssert<IOException>
public static <
the type of elements.
ELEMENT
>
IterableAssert<ELEMENT>

Returns:

the created assertion object.
thenIterable
(Iterable<? extends ELEMENT>
the actual value.
actual
)

Creates a new instance of IterableAssert.

public static <
the type of elements.
ELEMENT
>
IteratorAssert<ELEMENT>

Returns:

the created assertion object.
thenIterator
(Iterator<? extends ELEMENT>
the actual value.
actual
)

Creates a new instance of IteratorAssert.

public static <
the type of elements.
ELEMENT
>
ListAssert<ELEMENT>

Returns:

the created assertion object.
thenList
(List<? extends ELEMENT>
the actual value.
actual
)

Creates a new instance of ListAssert.

public static NotThrownAssert

Returns:

the created NotThrownAssert.
thenNoException
()

Entry point to check that no exception of any type is thrown by a given throwingCallable.

public static ThrowableTypeAssert<NullPointerException>
public static <
the type of the actual value.
T
>
ObjectAssert<T>

Returns:

the created assertion object.
thenObject
(T
the actual value.
actual
)

Creates a new instance of org.assertj.core.api.ObjectAssert for any object.

public static AbstractPathAssert<?>

Returns:

the created assertion object
thenPath
(Path
the path to test
actual
)

Creates a new instance of PathAssert

Use this over then(Path) in case of ambiguous method resolution when the object under test implements several interfaces Assertj provides then for.

public static <
the type of the value contained in the Predicate.
T
>
PredicateAssert<T>

Returns:

the created assertion object.
thenPredicate
(Predicate<T>
the actual value.
actual
)

Create assertion for Predicate.

public static ThrowableTypeAssert<ReflectiveOperationException>
public static ThrowableTypeAssert<RuntimeException>
public static <
the type of elements.
ELEMENT
>
ListAssert<ELEMENT>

Returns:

the created assertion object.
thenStream
(Stream<? extends ELEMENT>
the actual value.
actual
)

Creates a new instance of ListAssert from the given Stream.

public static AbstractThrowableAssert<?, ? extends Throwable>

Returns:

the created ThrowableAssert.
thenThrownBy
(ThrowableAssert.ThrowingCallable
The ThrowingCallable or lambda with the code that should raise the throwable.
shouldRaiseThrowable
)

Allows to capture and then assert on a Throwable (easier done with lambdas).

public static AbstractThrowableAssert<?, ? extends Throwable>

Returns:

the created ThrowableAssert.
thenThrownBy
(ThrowableAssert.ThrowingCallable
The ThrowingCallable or lambda with the code that should raise the throwable.
shouldRaiseThrowable
,
String
the new description to set.
description
,
Object...
optional parameter if description is a format String.
args
)

Allows to capture and then assert on a Throwable like thenThrownBy(ThrowingCallable) but this method let you set the assertion description the same way you do with as(String, Object...).

public static <
the type of the actual value.
T
>
ObjectAssert<T>

Returns:

the created assertion object.
thenWith
(T
the actual value.
actual
,
Consumer<T>...
to assert on the actual object - must not be null.
requirements
)

Uses the given instance as the instance under test for all the assertions expressed as the passed Consumers.

public static Tuple

Returns:

the built Tuple
tuple
(Object...
the values stored in the Tuple
values
)

Hides org.assertj.core.api.Assertions.tuple.

Utility method to build nicely a Tuple when working with IterableAssert#extracting(String...) or ObjectArrayAssert#extracting(String...)
public static void
useDefaultDateFormatsOnly()

Hides org.assertj.core.api.Assertions.useDefaultDateFormatsOnly.

Remove all registered custom date formats => use only the defaults date formats to parse string as date.
public static void
public static void
useRepresentation(Representation
the Representation to use
customRepresentation
)

Hides org.assertj.core.api.Assertions.useRepresentation.

Register a Representation that will be used in all following assertions.
public static Offset<Double>

Returns:

the created Offset.
within
(Double
the allowed offset
value
)

Hides org.assertj.core.api.Assertions.within.

Builds an Offset to use with isCloseTo assertions.
public static Offset<Float>

Returns:

the created Offset.
within
(Float
the allowed offset
value
)

Hides org.assertj.core.api.Assertions.within.

Builds an Offset to use with isCloseTo assertions.
public static Offset<BigDecimal>

Returns:

the created Offset.
within
(BigDecimal
the allowed offset
value
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for BigDecimal Offset to use with isCloseTo assertions.
public static Offset<BigInteger>

Returns:

the created Offset.
within
(BigInteger
the allowed offset
value
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for BigInteger Offset to use with isCloseTo assertions.
public static Offset<Byte>

Returns:

the created Offset.
within
(Byte
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for Byte Offset to use with isCloseTo assertions.
public static Offset<Integer>

Returns:

the created Offset.
within
(Integer
the value of the offset.
value
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for Integer Offset to use with isCloseTo assertions.
public static Offset<Short>

Returns:

the created Offset.
within
(Short
the allowed offset
value
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for Short Offset to use with isCloseTo assertions.
public static Offset<Long>

Returns:

the created Offset.
within
(Long
the allowed offset
value
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for Long Offset to use with isCloseTo assertions.
public static TemporalUnitOffset

Returns:

the created Offset.
within
(long
the allowed offset
value
,
TemporalUnit
the TemporalUnit of the offset
unit
)

Hides org.assertj.core.api.Assertions.within.

Assertions entry point for TemporalUnitOffset with less than or equal condition to use with isCloseTo temporal assertions.
public static Percentage

Returns:

the created Percentage.
withinPercentage
(Double
the required precision percentage
value
)

Hides org.assertj.core.api.Assertions.withinPercentage.

Assertions entry point for Double org.assertj.core.data.Percentage to use with isCloseTo assertions for percentages.
public static Percentage

Returns:

the created Percentage.
withinPercentage
(Integer
the required precision percentage
value
)

Hides org.assertj.core.api.Assertions.withinPercentage.

Assertions entry point for Integer org.assertj.core.data.Percentage to use with isCloseTo assertions for percentages.
public static Percentage

Returns:

the created Percentage.
withinPercentage
(Long
the required precision percentage
value
)

Hides org.assertj.core.api.Assertions.withinPercentage.

Assertions entry point for Long org.assertj.core.data.Percentage to use with isCloseTo assertions for percentages.
public static Duration

Returns:

the given value.
withMarginOf
(Duration
the allowed difference Duration.
allowedDifference
)

Hides org.assertj.core.api.Assertions.withMarginOf.

Syntactic sugar method to use with AbstractDurationAssert#isCloseTo(Duration, Duration) assertion.
public static Offset<Double>

Returns:

the created Offset.
withPrecision
(Double
the required precision
value
)

Hides org.assertj.core.api.Assertions.withPrecision.

Builds an Offset to use with real number assertions.
public static Offset<Float>

Returns:

the created Offset.
withPrecision
(Float
the required precision
value
)

Hides org.assertj.core.api.Assertions.withPrecision.

Builds an Offset to use with real number assertions.
Inherited from org.assertj.core.api.Assertions:
assertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatassertThatCharSequenceassertThatCodeassertThatCollectionassertThatComparableassertThatExceptionassertThatExceptionOfTypeassertThatIllegalArgumentExceptionassertThatIllegalStateExceptionassertThatIndexOutOfBoundsExceptionassertThatIOExceptionassertThatIterableassertThatIteratorassertThatListassertThatNoExceptionassertThatNullPointerExceptionassertThatObjectassertThatPathassertThatPredicateassertThatReflectiveOperationExceptionassertThatRuntimeExceptionassertThatStreamassertThatThrownByassertThatThrownByassertWithfailBecauseExceptionWasNotThrownfilterfilteroffsetoffset