public interface WithAssertions
Modifier and Type | Method and Description |
---|---|
default <T> Condition<T> |
allOf(Condition<? super T>... conditions)
Delegate call to
Assertions.allOf(Condition[]) |
default <T> Condition<T> |
allOf(java.lang.Iterable<? extends Condition<? super T>> conditions)
Delegate call to
Assertions.allOf(Iterable) |
default <T> Condition<T> |
anyOf(Condition<? super T>... conditions)
Delegate call to
Assertions.anyOf(Condition[]) |
default <T> Condition<T> |
anyOf(java.lang.Iterable<? extends Condition<? super T>> conditions)
Delegate call to
Assertions.anyOf(Iterable) |
default <ACTUAL extends java.lang.Iterable<? extends ELEMENT>,ELEMENT,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> |
assertThat(ACTUAL actual,
java.lang.Class<ELEMENT_ASSERT> assertClass)
Delegate call to
Assertions.assertThat(Iterable, Class) |
default <T> T |
assertThat(AssertProvider<T> component)
Delegate call to
Assertions.assertThat(AssertProvider) |
default AtomicBooleanAssert |
assertThat(java.util.concurrent.atomic.AtomicBoolean actual)
Create assertion for
AtomicBoolean . |
default AtomicIntegerAssert |
assertThat(java.util.concurrent.atomic.AtomicInteger actual)
Create assertion for
AtomicInteger . |
default AtomicIntegerArrayAssert |
assertThat(java.util.concurrent.atomic.AtomicIntegerArray actual)
Create int[] assertion for
AtomicIntegerArray . |
default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> |
assertThat(java.util.concurrent.atomic.AtomicIntegerFieldUpdater<OBJECT> actual)
Create assertion for
AtomicIntegerFieldUpdater . |
default AtomicLongAssert |
assertThat(java.util.concurrent.atomic.AtomicLong actual)
Create assertion for
AtomicLong . |
default AtomicLongArrayAssert |
assertThat(java.util.concurrent.atomic.AtomicLongArray actual)
Create assertion for
AtomicLongArray . |
default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> |
assertThat(java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT> actual)
Create assertion for
AtomicLongFieldUpdater . |
default <VALUE> AtomicMarkableReferenceAssert<VALUE> |
assertThat(java.util.concurrent.atomic.AtomicMarkableReference<VALUE> actual)
Create assertion for
AtomicMarkableReference . |
default <VALUE> AtomicReferenceAssert<VALUE> |
assertThat(java.util.concurrent.atomic.AtomicReference<VALUE> actual)
Create assertion for
AtomicReference . |
default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> |
assertThat(java.util.concurrent.atomic.AtomicReferenceArray<ELEMENT> actual)
Create assertion for
AtomicReferenceArray . |
default <FIELD,OBJECT> |
assertThat(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
Create assertion for
AtomicReferenceFieldUpdater . |
default <VALUE> AtomicStampedReferenceAssert<VALUE> |
assertThat(java.util.concurrent.atomic.AtomicStampedReference<VALUE> actual)
Create assertion for
AtomicStampedReference . |
default <ELEMENT,STREAM extends java.util.stream.BaseStream<ELEMENT,STREAM>> |
assertThat(java.util.stream.BaseStream<? extends ELEMENT,STREAM> actual)
Delegate call to
Assertions.assertThat(List) |
default AbstractBigDecimalAssert<?> |
assertThat(java.math.BigDecimal actual)
Delegate call to
Assertions.assertThat(BigDecimal) |
default AbstractBigIntegerAssert<?> |
assertThat(java.math.BigInteger actual)
Creates a new instance of
. |
default AbstractBooleanAssert<?> |
assertThat(boolean actual)
Delegate call to
Assertions.assertThat(boolean) |
default AbstractBooleanAssert<?> |
assertThat(java.lang.Boolean actual)
Delegate call to
Assertions.assertThat(Boolean) |
default AbstractBooleanArrayAssert<?> |
assertThat(boolean[] actual)
Delegate call to
Assertions.assertThat(boolean) |
default AbstractByteAssert<?> |
assertThat(byte actual)
Delegate call to
Assertions.assertThat(byte) |
default AbstractByteAssert<?> |
assertThat(java.lang.Byte actual)
Delegate call to
Assertions.assertThat(Byte) |
default AbstractByteArrayAssert<?> |
assertThat(byte[] actual)
Delegate call to
Assertions.assertThat(byte[]) |
default AbstractCharacterAssert<?> |
assertThat(char actual)
Delegate call to
Assertions.assertThat(char) |
default AbstractCharArrayAssert<?> |
assertThat(char[] actual)
Delegate call to
Assertions.assertThat(char[]) |
default AbstractCharacterAssert<?> |
assertThat(java.lang.Character actual)
Delegate call to
Assertions.assertThat(Character) |
default AbstractCharSequenceAssert<?,? extends java.lang.CharSequence> |
assertThat(java.lang.CharSequence actual)
Delegate call to
Assertions.assertThat(CharSequence) |
default AbstractClassAssert<?> |
assertThat(java.lang.Class<?> actual)
Delegate call to
Assertions.assertThat(Class) |
default <RESULT> CompletableFutureAssert<RESULT> |
assertThat(java.util.concurrent.CompletableFuture<RESULT> future)
Delegate call to
Assertions.assertThat(CompletableFuture) |
default AbstractDateAssert<?> |
assertThat(java.util.Date actual)
Delegate call to
Assertions.assertThat(Date) |
default AbstractDoubleAssert<?> |
assertThat(double actual)
Delegate call to
Assertions.assertThat(double) |
default AbstractDoubleAssert<?> |
assertThat(java.lang.Double actual)
Delegate call to
Assertions.assertThat(Double) |
default AbstractDoubleArrayAssert<?> |
assertThat(double[] actual)
Delegate call to
Assertions.assertThat(double[]) |
default DoublePredicateAssert |
assertThat(java.util.function.DoublePredicate actual)
Delegate call to
Assertions.assertThat(DoublePredicate) |
default AbstractFileAssert<?> |
assertThat(java.io.File actual)
Delegate call to
Assertions.assertThat(File) |
default AbstractFloatAssert<?> |
assertThat(float actual)
Delegate call to
Assertions.assertThat(float) |
default AbstractFloatAssert<?> |
assertThat(java.lang.Float actual)
Delegate call to
Assertions.assertThat(Float) |
default AbstractFloatArrayAssert<?> |
assertThat(float[] actual)
Delegate call to
Assertions.assertThat(float[]) |
default <RESULT> AbstractFutureAssert<?,? extends java.util.concurrent.Future<? extends RESULT>,RESULT> |
assertThat(java.util.concurrent.Future<RESULT> actual)
Delegate call to
Assertions.assertThat(Future) |
default AbstractInputStreamAssert<?,? extends java.io.InputStream> |
assertThat(java.io.InputStream actual)
Delegate call to
Assertions.assertThat(InputStream) |
default AbstractInstantAssert<?> |
assertThat(java.time.Instant actual)
Delegate call to
Assertions.assertThat(java.time.Instant) |
default AbstractIntegerAssert<?> |
assertThat(int actual)
Delegate call to
Assertions.assertThat(int) |
default AbstractIntArrayAssert<?> |
assertThat(int[] actual)
Delegate call to
Assertions.assertThat(int[]) |
default AbstractIntegerAssert<?> |
assertThat(java.lang.Integer actual)
Delegate call to
Assertions.assertThat(Integer) |
default IntPredicateAssert |
assertThat(java.util.function.IntPredicate actual)
Delegate call to
Assertions.assertThat(IntPredicate) |
default <ACTUAL extends java.lang.Iterable<? extends ELEMENT>,ELEMENT,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> |
assertThat(java.lang.Iterable<? extends ELEMENT> actual,
AssertFactory<ELEMENT,ELEMENT_ASSERT> assertFactory)
Delegate call to
Assertions.assertThat(Iterable, AssertFactory) |
default <T> IterableAssert<T> |
assertThat(java.lang.Iterable<? extends T> actual)
Delegate call to
Assertions.assertThat(Iterable) |
default <T> IterableAssert<T> |
assertThat(java.util.Iterator<? extends T> actual)
Delegate call to
Assertions.assertThat(Iterator) |
default <ACTUAL extends java.util.List<? extends ELEMENT>,ELEMENT,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> |
assertThat(java.util.List<? extends ELEMENT> actual,
AssertFactory<ELEMENT,ELEMENT_ASSERT> assertFactory)
Delegate call to
Assertions.assertThat(List, AssertFactory) )} |
default <ELEMENT,ACTUAL extends java.util.List<? extends ELEMENT>,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> |
assertThat(java.util.List<? extends ELEMENT> actual,
java.lang.Class<ELEMENT_ASSERT> assertClass)
Delegate call to
Assertions.assertThat(List, Class) )} |
default <T> ListAssert<? extends T> |
assertThat(java.util.List<? extends T> actual)
Delegate call to
Assertions.assertThat(List) |
default AbstractLocalDateAssert<?> |
assertThat(java.time.LocalDate localDate)
Delegate call to
Assertions.assertThat(LocalDate) |
default AbstractLocalDateTimeAssert<?> |
assertThat(java.time.LocalDateTime localDateTime)
Delegate call to
Assertions.assertThat(LocalDateTime) |
default AbstractLocalTimeAssert<?> |
assertThat(java.time.LocalTime localTime)
Delegate call to
Assertions.assertThat(LocalTime) |
default AbstractLongAssert<?> |
assertThat(long actual)
Delegate call to
Assertions.assertThat(long) |
default AbstractLongAssert<?> |
assertThat(java.lang.Long actual)
Delegate call to
Assertions.assertThat(Long) |
default AbstractLongArrayAssert<?> |
assertThat(long[] actual)
Delegate call to
Assertions.assertThat(long[]) |
default LongPredicateAssert |
assertThat(java.util.function.LongPredicate actual)
Delegate call to
Assertions.assertThat(LongPredicate) |
default <K,V> MapAssert<K,V> |
assertThat(java.util.Map<K,V> actual)
Delegate call to
Assertions.assertThat(Map) |
default AbstractOffsetDateTimeAssert<?> |
assertThat(java.time.OffsetDateTime offsetDateTime)
Delegate call to
Assertions.assertThat(OffsetDateTime) |
default AbstractOffsetTimeAssert<?> |
assertThat(java.time.OffsetTime offsetTime)
Delegate call to
Assertions.assertThat(OffsetTime) |
default <VALUE> OptionalAssert<VALUE> |
assertThat(java.util.Optional<VALUE> optional)
Delegate call to
Assertions.assertThat(Optional) |
default OptionalDoubleAssert |
assertThat(java.util.OptionalDouble optional)
Delegate call to
Assertions.assertThat(java.util.OptionalDouble) |
default OptionalIntAssert |
assertThat(java.util.OptionalInt optional)
Delegate call to
Assertions.assertThat(java.util.OptionalInt) |
default OptionalLongAssert |
assertThat(java.util.OptionalLong optional)
Delegate call to
Assertions.assertThat(java.util.OptionalLong) |
default AbstractPathAssert<?> |
assertThat(java.nio.file.Path actual)
Delegate call to
Assertions.assertThat(Path) |
default <T> PredicateAssert<T> |
assertThat(java.util.function.Predicate<T> actual)
Delegate call to
Assertions.assertThat(Predicate) |
default AbstractShortAssert<?> |
assertThat(short actual)
Delegate call to
Assertions.assertThat(short) |
default AbstractShortAssert<?> |
assertThat(java.lang.Short actual)
Delegate call to
Assertions.assertThat(Short) |
default AbstractShortArrayAssert<?> |
assertThat(short[] actual)
Delegate call to
Assertions.assertThat(short[]) |
default AbstractCharSequenceAssert<?,java.lang.String> |
assertThat(java.lang.String actual)
Delegate call to
Assertions.assertThat(String) |
default <T> AbstractObjectAssert<?,T> |
assertThat(T actual)
Delegate call to
Assertions.assertThat(Object) |
default <T extends java.lang.Comparable<? super T>> |
assertThat(T actual)
Delegate call to
Assertions.assertThat(Comparable) |
default <T extends AssertDelegateTarget> |
assertThat(T assertion)
Delegate call to
Assertions.assertThat(AssertDelegateTarget) |
default <T> AbstractObjectArrayAssert<?,T> |
assertThat(T[] actual)
Delegate call to
Assertions.assertThat(Object[]) |
default AbstractThrowableAssert<?,? extends java.lang.Throwable> |
assertThat(java.lang.Throwable actual)
Delegate call to
Assertions.assertThat(Throwable) |
default AbstractUriAssert<?> |
assertThat(java.net.URI actual)
Delegate call to
Assertions.assertThat(URI) |
default AbstractUrlAssert<?> |
assertThat(java.net.URL actual)
Delegate call to
Assertions.assertThat(URL) |
default AbstractZonedDateTimeAssert<?> |
assertThat(java.time.ZonedDateTime actual)
Delegate call to
Assertions.assertThat(ZonedDateTime) |
default AbstractThrowableAssert<?,? extends java.lang.Throwable> |
assertThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Allows to capture and then assert on a
Throwable more easily when used with Java 8 lambdas. |
default <T extends java.lang.Throwable> |
assertThatExceptionOfType(java.lang.Class<? extends T> 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. |
default AbstractThrowableAssert<?,? extends java.lang.Throwable> |
assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Delegate call to
Assertions.assertThatThrownBy(ThrowableAssert.ThrowingCallable) |
default Index |
atIndex(int actual)
Delegate call to
Assertions.atIndex(int) |
default java.lang.Throwable |
catchThrowable(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Delegate call to
Assertions.catchThrowable(ThrowableAssert.ThrowingCallable) |
default java.lang.String |
contentOf(java.io.File actual)
Delegate call to
Assertions.contentOf(File) |
default java.lang.String |
contentOf(java.io.File file,
java.nio.charset.Charset charset)
Delegate call to
Assertions.contentOf(File,Charset) |
default java.lang.String |
contentOf(java.io.File file,
java.lang.String charsetName)
Delegate call to
Assertions.contentOf(File,String) |
default <T> DoesNotHave<T> |
doesNotHave(Condition<? super T> condition)
Delegate call to
Assertions.doesNotHave(Condition) |
default <K,V> MapEntry<K,V> |
entry(K key,
V value)
Delegate call to
Assertions.entry(Object, Object) |
default Properties<java.lang.Object> |
extractProperty(java.lang.String propertyName)
Delegate call to
Assertions.extractProperty(String) |
default <T> Properties<T> |
extractProperty(java.lang.String propertyName,
java.lang.Class<T> propertyType)
Delegate call to
Assertions.extractProperty(String,Class) |
default void |
fail(java.lang.String failureMessage)
Delegate call to
Assertions.fail(String) |
default void |
fail(java.lang.String failureMessage,
java.lang.Throwable realCause)
Delegate call to
Assertions.fail(String,Throwable) |
default void |
failBecauseExceptionWasNotThrown(java.lang.Class<? extends java.lang.Throwable> exceptionClass)
|
default <E> Filters<E> |
filter(E[] array)
Delegate call to
Assertions.filter(Object[]) |
default <E> Filters<E> |
filter(java.lang.Iterable<E> iterableToFilter)
Delegate call to
Assertions.filter(Iterable) |
default java.util.List<java.lang.String> |
linesOf(java.io.File actual)
Delegate call to
Assertions.linesOf(File) |
default java.util.List<java.lang.String> |
linesOf(java.io.File actual,
java.nio.charset.Charset arg1)
Delegate call to
Assertions.linesOf(File,Charset) |
default java.util.List<java.lang.String> |
linesOf(java.io.File file,
java.lang.String charsetName)
Delegate call to
Assertions.linesOf(File,String) |
default <T> Not<T> |
not(Condition<? super T> condition)
Delegate call to
Assertions.not(Condition) |
default Offset<java.lang.Double> |
offset(java.lang.Double value)
Delegate call to
Assertions.offset(Double) |
default Offset<java.lang.Float> |
offset(java.lang.Float value)
Delegate call to
Assertions.offset(Float) |
default void |
registerCustomDateFormat(java.text.DateFormat actual)
Delegate call to
Assertions.registerCustomDateFormat(DateFormat) |
default void |
registerCustomDateFormat(java.lang.String actual)
Delegate call to
Assertions.registerCustomDateFormat(String) |
default void |
setAllowExtractingPrivateFields(boolean actual)
Delegate call to
Assertions.setAllowExtractingPrivateFields(boolean) |
default void |
setRemoveAssertJRelatedElementsFromStackTrace(boolean actual)
Delegate call to
Assertions.setRemoveAssertJRelatedElementsFromStackTrace(boolean) |
default Tuple |
tuple(java.lang.Object... values)
Delegate call to
Assertions.tuple(Object[]) |
default void |
useDefaultDateFormatsOnly()
Delegate call to
Assertions.useDefaultDateFormatsOnly() |
default Offset<java.math.BigDecimal> |
within(java.math.BigDecimal actual)
Delegate call to
Assertions.within(BigDecimal) |
default Offset<java.lang.Double> |
within(java.lang.Double actual)
Delegate call to
Assertions.within(Double) |
default Offset<java.lang.Float> |
within(java.lang.Float actual)
Delegate call to
Assertions.within(Float) |
default Offset<java.lang.Float> offset(java.lang.Float value)
Assertions.offset(Float)
default Offset<java.lang.Double> offset(java.lang.Double value)
Assertions.offset(Double)
default <K,V> MapEntry<K,V> entry(K key, V value)
Assertions.entry(Object, Object)
default void fail(java.lang.String failureMessage)
Assertions.fail(String)
default void fail(java.lang.String failureMessage, java.lang.Throwable realCause)
Assertions.fail(String,Throwable)
default <T> Not<T> not(Condition<? super T> condition)
Assertions.not(Condition)
default <T> Condition<T> allOf(java.lang.Iterable<? extends Condition<? super T>> conditions)
Assertions.allOf(Iterable)
default <T> Condition<T> allOf(Condition<? super T>... conditions)
Assertions.allOf(Condition[])
default <T> AbstractObjectArrayAssert<?,T> assertThat(T[] actual)
Assertions.assertThat(Object[])
default <T extends AssertDelegateTarget> T assertThat(T assertion)
Assertions.assertThat(AssertDelegateTarget)
default <K,V> MapAssert<K,V> assertThat(java.util.Map<K,V> actual)
Assertions.assertThat(Map)
default AbstractShortAssert<?> assertThat(short actual)
Assertions.assertThat(short)
default AbstractLongAssert<?> assertThat(long actual)
Assertions.assertThat(long)
default AbstractLongAssert<?> assertThat(java.lang.Long actual)
Assertions.assertThat(Long)
default AbstractLongArrayAssert<?> assertThat(long[] actual)
Assertions.assertThat(long[])
default <T> AbstractObjectAssert<?,T> assertThat(T actual)
Assertions.assertThat(Object)
default AbstractCharSequenceAssert<?,java.lang.String> assertThat(java.lang.String actual)
Assertions.assertThat(String)
default AbstractDateAssert<?> assertThat(java.util.Date actual)
Assertions.assertThat(Date)
default AbstractThrowableAssert<?,? extends java.lang.Throwable> assertThat(java.lang.Throwable actual)
Assertions.assertThat(Throwable)
default AbstractBigDecimalAssert<?> assertThat(java.math.BigDecimal actual)
Assertions.assertThat(BigDecimal)
default AbstractBigIntegerAssert<?> assertThat(java.math.BigInteger actual)
BigIntegerAssert
.actual
- the actual value.default AtomicBooleanAssert assertThat(java.util.concurrent.atomic.AtomicBoolean actual)
AtomicBoolean
.actual
- the actual value.default AtomicIntegerAssert assertThat(java.util.concurrent.atomic.AtomicInteger actual)
AtomicInteger
.actual
- the actual value.default AtomicIntegerArrayAssert assertThat(java.util.concurrent.atomic.AtomicIntegerArray actual)
AtomicIntegerArray
.actual
- the actual value.default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assertThat(java.util.concurrent.atomic.AtomicIntegerFieldUpdater<OBJECT> actual)
AtomicIntegerFieldUpdater
.OBJECT
- the type of the object holding the updatable field.actual
- the actual value.default AtomicLongAssert assertThat(java.util.concurrent.atomic.AtomicLong actual)
AtomicLong
.actual
- the actual value.default AtomicLongArrayAssert assertThat(java.util.concurrent.atomic.AtomicLongArray actual)
AtomicLongArray
.actual
- the actual value.default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assertThat(java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT> actual)
AtomicLongFieldUpdater
.OBJECT
- the type of the object holding the updatable field.actual
- the actual value.default <VALUE> AtomicReferenceAssert<VALUE> assertThat(java.util.concurrent.atomic.AtomicReference<VALUE> actual)
AtomicReference
.VALUE
- the type of the value contained in the AtomicReference
.actual
- the actual value.default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assertThat(java.util.concurrent.atomic.AtomicReferenceArray<ELEMENT> actual)
AtomicReferenceArray
.ELEMENT
- the type of the value contained in the AtomicReferenceArray
.actual
- the actual value.default <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assertThat(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
AtomicReferenceFieldUpdater
.FIELD
- the type of the field which gets updated by the AtomicReferenceFieldUpdater
.OBJECT
- the type of the object holding the updatable field.actual
- the actual value.default <VALUE> AtomicMarkableReferenceAssert<VALUE> assertThat(java.util.concurrent.atomic.AtomicMarkableReference<VALUE> actual)
AtomicMarkableReference
.VALUE
- the type of the value contained in the AtomicMarkableReference
.actual
- the actual value.default <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(java.util.concurrent.atomic.AtomicStampedReference<VALUE> actual)
AtomicStampedReference
.VALUE
- the type of the value contained in the AtomicStampedReference
.actual
- the actual value.default AbstractCharSequenceAssert<?,? extends java.lang.CharSequence> assertThat(java.lang.CharSequence actual)
Assertions.assertThat(CharSequence)
default AbstractShortArrayAssert<?> assertThat(short[] actual)
Assertions.assertThat(short[])
default AbstractShortAssert<?> assertThat(java.lang.Short actual)
Assertions.assertThat(Short)
default AbstractClassAssert<?> assertThat(java.lang.Class<?> actual)
Assertions.assertThat(Class)
default AbstractCharacterAssert<?> assertThat(java.lang.Character actual)
Assertions.assertThat(Character)
default AbstractCharArrayAssert<?> assertThat(char[] actual)
Assertions.assertThat(char[])
default AbstractCharacterAssert<?> assertThat(char actual)
Assertions.assertThat(char)
default <T extends java.lang.Comparable<? super T>> AbstractComparableAssert<?,T> assertThat(T actual)
Assertions.assertThat(Comparable)
default <T> IterableAssert<T> assertThat(java.lang.Iterable<? extends T> actual)
Assertions.assertThat(Iterable)
default <ACTUAL extends java.lang.Iterable<? extends ELEMENT>,ELEMENT,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> FactoryBasedNavigableIterableAssert<?,ACTUAL,ELEMENT,ELEMENT_ASSERT> assertThat(java.lang.Iterable<? extends ELEMENT> actual, AssertFactory<ELEMENT,ELEMENT_ASSERT> assertFactory)
Assertions.assertThat(Iterable, AssertFactory)
default <T> IterableAssert<T> assertThat(java.util.Iterator<? extends T> actual)
Assertions.assertThat(Iterator)
default <ACTUAL extends java.lang.Iterable<? extends ELEMENT>,ELEMENT,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> ClassBasedNavigableIterableAssert<?,ACTUAL,ELEMENT,ELEMENT_ASSERT> assertThat(ACTUAL actual, java.lang.Class<ELEMENT_ASSERT> assertClass)
Assertions.assertThat(Iterable, Class)
default AbstractBooleanAssert<?> assertThat(java.lang.Boolean actual)
Assertions.assertThat(Boolean)
default AbstractBooleanArrayAssert<?> assertThat(boolean[] actual)
Assertions.assertThat(boolean)
default AbstractByteAssert<?> assertThat(byte actual)
Assertions.assertThat(byte)
default AbstractByteAssert<?> assertThat(java.lang.Byte actual)
Assertions.assertThat(Byte)
default AbstractByteArrayAssert<?> assertThat(byte[] actual)
Assertions.assertThat(byte[])
default AbstractBooleanAssert<?> assertThat(boolean actual)
Assertions.assertThat(boolean)
default AbstractFloatAssert<?> assertThat(float actual)
Assertions.assertThat(float)
default AbstractInputStreamAssert<?,? extends java.io.InputStream> assertThat(java.io.InputStream actual)
Assertions.assertThat(InputStream)
default AbstractFileAssert<?> assertThat(java.io.File actual)
Assertions.assertThat(File)
default <RESULT> AbstractFutureAssert<?,? extends java.util.concurrent.Future<? extends RESULT>,RESULT> assertThat(java.util.concurrent.Future<RESULT> actual)
Assertions.assertThat(Future)
default AbstractPathAssert<?> assertThat(java.nio.file.Path actual)
Assertions.assertThat(Path)
default AbstractIntArrayAssert<?> assertThat(int[] actual)
Assertions.assertThat(int[])
default AbstractFloatAssert<?> assertThat(java.lang.Float actual)
Assertions.assertThat(Float)
default AbstractIntegerAssert<?> assertThat(int actual)
Assertions.assertThat(int)
default AbstractFloatArrayAssert<?> assertThat(float[] actual)
Assertions.assertThat(float[])
default AbstractIntegerAssert<?> assertThat(java.lang.Integer actual)
Assertions.assertThat(Integer)
default AbstractDoubleAssert<?> assertThat(double actual)
Assertions.assertThat(double)
default AbstractDoubleAssert<?> assertThat(java.lang.Double actual)
Assertions.assertThat(Double)
default <T> ListAssert<? extends T> assertThat(java.util.List<? extends T> actual)
Assertions.assertThat(List)
default <ELEMENT,ACTUAL extends java.util.List<? extends ELEMENT>,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> ClassBasedNavigableListAssert<?,ACTUAL,ELEMENT,ELEMENT_ASSERT> assertThat(java.util.List<? extends ELEMENT> actual, java.lang.Class<ELEMENT_ASSERT> assertClass)
Assertions.assertThat(List, Class)
)}default <ACTUAL extends java.util.List<? extends ELEMENT>,ELEMENT,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT,ELEMENT>> FactoryBasedNavigableListAssert<?,ACTUAL,ELEMENT,ELEMENT_ASSERT> assertThat(java.util.List<? extends ELEMENT> actual, AssertFactory<ELEMENT,ELEMENT_ASSERT> assertFactory)
Assertions.assertThat(List, AssertFactory)
)}default <ELEMENT,STREAM extends java.util.stream.BaseStream<ELEMENT,STREAM>> AbstractListAssert<?,? extends java.util.List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>> assertThat(java.util.stream.BaseStream<? extends ELEMENT,STREAM> actual)
Assertions.assertThat(List)
default AbstractDoubleArrayAssert<?> assertThat(double[] actual)
Assertions.assertThat(double[])
default Properties<java.lang.Object> extractProperty(java.lang.String propertyName)
Assertions.extractProperty(String)
default <T> Properties<T> extractProperty(java.lang.String propertyName, java.lang.Class<T> propertyType)
Assertions.extractProperty(String,Class)
default Tuple tuple(java.lang.Object... values)
Assertions.tuple(Object[])
default Index atIndex(int actual)
Assertions.atIndex(int)
default Offset<java.lang.Double> within(java.lang.Double actual)
Assertions.within(Double)
default Offset<java.math.BigDecimal> within(java.math.BigDecimal actual)
Assertions.within(BigDecimal)
default Offset<java.lang.Float> within(java.lang.Float actual)
Assertions.within(Float)
default <T> Condition<T> anyOf(java.lang.Iterable<? extends Condition<? super T>> conditions)
Assertions.anyOf(Iterable)
default <T> Condition<T> anyOf(Condition<? super T>... conditions)
Assertions.anyOf(Condition[])
default <T> DoesNotHave<T> doesNotHave(Condition<? super T> condition)
Assertions.doesNotHave(Condition)
default java.lang.String contentOf(java.io.File file, java.lang.String charsetName)
Assertions.contentOf(File,String)
default java.lang.String contentOf(java.io.File actual)
Assertions.contentOf(File)
default java.lang.String contentOf(java.io.File file, java.nio.charset.Charset charset)
Assertions.contentOf(File,Charset)
default java.util.List<java.lang.String> linesOf(java.io.File actual)
Assertions.linesOf(File)
default java.util.List<java.lang.String> linesOf(java.io.File file, java.lang.String charsetName)
Assertions.linesOf(File,String)
default java.util.List<java.lang.String> linesOf(java.io.File actual, java.nio.charset.Charset arg1)
Assertions.linesOf(File,Charset)
default void setRemoveAssertJRelatedElementsFromStackTrace(boolean actual)
Assertions.setRemoveAssertJRelatedElementsFromStackTrace(boolean)
default void failBecauseExceptionWasNotThrown(java.lang.Class<? extends java.lang.Throwable> exceptionClass)
default void setAllowExtractingPrivateFields(boolean actual)
Assertions.setAllowExtractingPrivateFields(boolean)
default void registerCustomDateFormat(java.text.DateFormat actual)
Assertions.registerCustomDateFormat(DateFormat)
default void registerCustomDateFormat(java.lang.String actual)
Assertions.registerCustomDateFormat(String)
default void useDefaultDateFormatsOnly()
Assertions.useDefaultDateFormatsOnly()
default AbstractZonedDateTimeAssert<?> assertThat(java.time.ZonedDateTime actual)
Assertions.assertThat(ZonedDateTime)
default <RESULT> CompletableFutureAssert<RESULT> assertThat(java.util.concurrent.CompletableFuture<RESULT> future)
Assertions.assertThat(CompletableFuture)
default <VALUE> OptionalAssert<VALUE> assertThat(java.util.Optional<VALUE> optional)
Assertions.assertThat(Optional)
default OptionalDoubleAssert assertThat(java.util.OptionalDouble optional)
Assertions.assertThat(java.util.OptionalDouble)
default OptionalIntAssert assertThat(java.util.OptionalInt optional)
Assertions.assertThat(java.util.OptionalInt)
default OptionalLongAssert assertThat(java.util.OptionalLong optional)
Assertions.assertThat(java.util.OptionalLong)
default AbstractLocalDateTimeAssert<?> assertThat(java.time.LocalDateTime localDateTime)
Assertions.assertThat(LocalDateTime)
default AbstractLocalDateAssert<?> assertThat(java.time.LocalDate localDate)
Assertions.assertThat(LocalDate)
default AbstractLocalTimeAssert<?> assertThat(java.time.LocalTime localTime)
Assertions.assertThat(LocalTime)
default AbstractInstantAssert<?> assertThat(java.time.Instant actual)
Assertions.assertThat(java.time.Instant)
default AbstractOffsetTimeAssert<?> assertThat(java.time.OffsetTime offsetTime)
Assertions.assertThat(OffsetTime)
default AbstractOffsetDateTimeAssert<?> assertThat(java.time.OffsetDateTime offsetDateTime)
Assertions.assertThat(OffsetDateTime)
default AbstractThrowableAssert<?,? extends java.lang.Throwable> assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Assertions.assertThatThrownBy(ThrowableAssert.ThrowingCallable)
default AbstractThrowableAssert<?,? extends java.lang.Throwable> assertThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Throwable
more easily when used with Java 8 lambdas.
Example :
ThrowingCallable callable = () -> {
throw new Exception("boom!");
};
// assertion succeeds
assertThatCode(callable).isInstanceOf(Exception.class)
.hasMessageContaining("boom");
// assertion fails
assertThatCode(callable).doesNotThrowAnyException();
If the provided ThrowableAssert.ThrowingCallable
does not validate against next assertions, an error is immediately raised,
in that case the test description provided with as(String, Object...)
is not honored.
To use a test description, use catchThrowable(ThrowableAssert.ThrowingCallable)
as shown below.
ThrowingCallable doNothing = () -> {
// do nothing
};
// assertion fails and "display me" appears in the assertion error
assertThatCode(doNothing).as("display me")
.isInstanceOf(Exception.class);
// assertion will fail AND "display me" will appear in the error
Throwable thrown = catchThrowable(doNothing);
assertThatCode(thrown).as("display me")
.isInstanceOf(Exception.class);
This method was not named assertThat
because the java compiler reported it ambiguous when used directly with a lambda :(
shouldRaiseOrNotThrowable
- The ThrowableAssert.ThrowingCallable
or lambda with the code that should raise the throwable.null
if none was raised by the callable.default java.lang.Throwable catchThrowable(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Assertions.catchThrowable(ThrowableAssert.ThrowingCallable)
default <T extends java.lang.Throwable> ThrowableTypeAssert<T> assertThatExceptionOfType(java.lang.Class<? extends T> exceptionType)
throwingCallable
which allows to chain assertions on the thrown exception.
Example:
assertThatExceptionOfType(IOException.class).isThrownBy(() -> { throw new IOException("boom!"); })
.withMessage("boom!");
This method is more or less the same of assertThatThrownBy(ThrowableAssert.ThrowingCallable)
but in a more natural way.exceptionType
- the actual value.ThrowableTypeAssert
.default <T> PredicateAssert<T> assertThat(java.util.function.Predicate<T> actual)
Assertions.assertThat(Predicate)
default IntPredicateAssert assertThat(java.util.function.IntPredicate actual)
Assertions.assertThat(IntPredicate)
default LongPredicateAssert assertThat(java.util.function.LongPredicate actual)
Assertions.assertThat(LongPredicate)
default DoublePredicateAssert assertThat(java.util.function.DoublePredicate actual)
Assertions.assertThat(DoublePredicate)
default AbstractUrlAssert<?> assertThat(java.net.URL actual)
Assertions.assertThat(URL)
default AbstractUriAssert<?> assertThat(java.net.URI actual)
Assertions.assertThat(URI)
default <T> T assertThat(AssertProvider<T> component)
Assertions.assertThat(AssertProvider)
default <E> Filters<E> filter(E[] array)
Assertions.filter(Object[])
default <E> Filters<E> filter(java.lang.Iterable<E> iterableToFilter)
Assertions.filter(Iterable)