| Modifier and Type | Method and Description |
|---|---|
| public < the type of the resulting ASSERT extends AbstractAssertAssert. | Returns: the narrowedAssert instance.the factory which verifies the type and creates the new instanceOfAssertFactory)Assert.Uses an |
| public AbstractListAssert | Returns: a list assertion object
Deprecated
use
Verifies that the actual value is an instance of List,
and returns a list assertion, to allow chaining of list-specific
assertions from this call.
asInstanceOf(InstanceOfAssertFactories. instead
|
| public AbstractCharSequenceAssert | Returns: a string assertion objectReturns a String assertion for the |
| public SELF | Returns: this assertion object.the object to check type against. other)Verifies that the actual value does not have the same class as the given object. |
| public SELF | Returns: this assertion object.the object to check hashCode against. other)Verifies that the actual object does not have the same hashCode as the given object. |
| public SELF | Returns: this assertion object.the String to check against. otherToString)Verifies that actual |
| public SELF | Returns: this assertion object.the format string to use. expectedStringTemplate, Object... the arguments to interpolate into the format string. args)Verifies that actual |
| public boolean | |
| public SELF | Returns: this assertion object.the object to check type against. other)Verifies that the actual value has the same class as the given object. |
| public SELF | Returns: this assertion object.the object to check hashCode against. other)Verifies that the actual object has the same hashCode as the given object. |
| public SELF | Returns: this assertion object.the expected String description of actual. expectedToString)Verifies that actual |
| public SELF | Returns: this assertion object.the format string to use. expectedStringTemplate, Object... the arguments to interpolate into the format string. args)Verifies that actual |
| public SELF | |
| public SELF | Returns: this assertion object.the type to check the actual value against. type)Verifies that the actual value is exactly an instance of the given type. |
| public SELF | |
| public SELF | |
| public SELF | Returns: this assertion object.the type to check the actual value against. type)Verifies that the actual value is an instance of the given type. |
| public SELF | Returns: this assertion object.the types to check the actual value against. types)Verifies that the actual value is an instance of any of the given types. |
| public < the generic type to check the actual value against. T> SELF | Returns: this assertion object.the type to check the actual value against. type, Consumer<T> the requirements expressed as a requirements)Consumer.Verifies that the actual value is an instance of the given type satisfying the given requirements expressed as a |
| public SELF | Returns: this assertion object.the given value to compare the actual value to. other)Verifies that the actual value is not equal to the given one. |
| public SELF | Returns: this assertion object.the type to check the actual value against. type)Verifies that the actual value is not exactly an instance of given type. |
| public SELF | |
| public SELF | |
| public SELF | Returns: this assertion object.the type to check the actual value against. type)Verifies that the actual value is not an instance of the given type. |
| public SELF | Returns: this assertion object.the types to check the actual value against. types)Verifies that the actual value is not an instance of any of the given types. |
| public SELF | |
| public SELF | Returns: this assertion object.the types to check the actual value against. types)Verifies that the actual value type is not in given types. |
| public SELF | Returns: this assertion object.the given value to compare the actual value to. other)Verifies that the actual value is not the same as the given one, i.e., using == comparison. |
| public void | |
| public SELF | Returns: this assertion object.the types to check the actual value against. types)Verifies that the actual value type is in given types. |
| public SELF | |
| public SELF | Returns: this assertion object.the comparator to use for the incoming assertion checks. customComparator)Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks. |
| public SELF | Returns: this assertion object.the comparator to use for the incoming assertion checks. customComparator, String comparator description to be used in assertion error messages customComparatorDescription)Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks. |
| public SELF | Returns: this assertion object.Revert to standard comparison for the incoming assertion checks. |
| public SELF | Returns: this assertion object.Describe/represent values in AssertJ error messages. representation)Use the given |
| public SELF | Returns: this assertion object.In case of an assertion error, a thread dump will be printed to |
| asInstanceOf | back to summary |
|---|---|
| public <ASSERT extends AbstractAssert Uses an
Additional factories can be created with custom Example:
| |
| asList | back to summary |
|---|---|
| public AbstractListAssert Deprecated use Verifies that the actual value is an instance of List, and returns a list assertion, to allow chaining of list-specific assertions from this call. Example :
| |
| asString | back to summary |
|---|---|
| public AbstractCharSequenceAssert Returns a String assertion for the Example :
| |
| doesNotHaveSameClassAs | back to summary |
|---|---|
| public SELF doesNotHaveSameClassAs(Object other) Verifies that the actual value does not have the same class as the given object. Example:
| |
| doesNotHaveSameHashCodeAs | back to summary |
|---|---|
| public SELF doesNotHaveSameHashCodeAs(Object other) Verifies that the actual object does not have the same hashCode as the given object. Example:
| |
| doesNotHaveToString | back to summary |
|---|---|
| public SELF doesNotHaveToString(String otherToString) Verifies that actual Example :
| |
| doesNotHaveToString | back to summary |
|---|---|
| public SELF doesNotHaveToString(String expectedStringTemplate, Object... args) Verifies that actual Example:
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj)
Deprecated Throws
| |
| hasSameClassAs | back to summary |
|---|---|
| public SELF hasSameClassAs(Object other) Verifies that the actual value has the same class as the given object. Example:
| |
| hasSameHashCodeAs | back to summary |
|---|---|
| public SELF hasSameHashCodeAs(Object other) Verifies that the actual object has the same hashCode as the given object. Example:
| |
| hasToString | back to summary |
|---|---|
| public SELF hasToString(String expectedToString) Verifies that actual Example :
| |
| hasToString | back to summary |
|---|---|
| public SELF hasToString(String expectedStringTemplate, Object... args) Verifies that actual Example:
| |
| isEqualTo | back to summary |
|---|---|
| public SELF isEqualTo(Object expected) Verifies that the actual value is equal to the given one. Example:
| |
| isExactlyInstanceOf | back to summary |
|---|---|
| public SELF isExactlyInstanceOf(Class<?> type) Verifies that the actual value is exactly an instance of the given type. Example:
| |
| isIn | back to summary |
|---|---|
| public SELF isIn(Object... values) Verifies that the actual value is present in the given array of values. This assertion always fails if the given array of values is empty. Example:
| |
| isIn | back to summary |
|---|---|
| public SELF isIn(Iterable<?> values) Verifies that the actual value is present in the given iterable. This assertion always fails if the given iterable is empty. Example:
| |
| isInstanceOf | back to summary |
|---|---|
| public SELF isInstanceOf(Class<?> type) Verifies that the actual value is an instance of the given type. Example:
| |
| isInstanceOfAny | back to summary |
|---|---|
| public SELF isInstanceOfAny(Class<?>... types) Verifies that the actual value is an instance of any of the given types. Example:
| |
| isInstanceOfSatisfying | back to summary |
|---|---|
| public <T> SELF isInstanceOfSatisfying(Class<T> type, Consumer<T> requirements) Verifies that the actual value is an instance of the given type satisfying the given requirements expressed as a This is useful to perform a group of assertions on a single object after checking its runtime type. Example:
| |
| isNotEqualTo | back to summary |
|---|---|
| public SELF isNotEqualTo(Object other) Verifies that the actual value is not equal to the given one. Example:
| |
| isNotExactlyInstanceOf | back to summary |
|---|---|
| public SELF isNotExactlyInstanceOf(Class<?> type) Verifies that the actual value is not exactly an instance of given type. Example:
| |
| isNotIn | back to summary |
|---|---|
| public SELF isNotIn(Object... values) Verifies that the actual value is not present in the given array of values. This assertion always succeeds if the given array of values is empty. Example:
| |
| isNotIn | back to summary |
|---|---|
| public SELF isNotIn(Iterable<?> values) Verifies that the actual value is not present in the given iterable. This assertion always succeeds if the given iterable is empty. Example:
| |
| isNotInstanceOf | back to summary |
|---|---|
| public SELF isNotInstanceOf(Class<?> type) Verifies that the actual value is not an instance of the given type. Example:
| |
| isNotInstanceOfAny | back to summary |
|---|---|
| public SELF isNotInstanceOfAny(Class<?>... types) Verifies that the actual value is not an instance of any of the given types. Example:
| |
| isNotNull | back to summary |
|---|---|
| public SELF isNotNull() Verifies that the actual value is not Example:
| |
| isNotOfAnyClassIn | back to summary |
|---|---|
| public SELF isNotOfAnyClassIn(Class<?>... types) Verifies that the actual value type is not in given types. Example:
| |
| isNotSameAs | back to summary |
|---|---|
| public SELF isNotSameAs(Object other) Verifies that the actual value is not the same as the given one, i.e., using == comparison. Example:
| |
| isNull | back to summary |
|---|---|
| public void isNull() Verifies that the actual value is Example:
| |
| isOfAnyClassIn | back to summary |
|---|---|
| public SELF isOfAnyClassIn(Class<?>... types) Verifies that the actual value type is in given types. Example:
| |
| isSameAs | back to summary |
|---|---|
| public SELF isSameAs(Object expected) Verifies that the actual value is the same as the given one, i.e., using == comparison. Example:
| |
| usingComparator | back to summary |
|---|---|
| public SELF usingComparator(Comparator<? super ACTUAL> customComparator) Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks. The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used. Examples :
| |
| usingComparator | back to summary |
|---|---|
| public SELF usingComparator(Comparator<? super ACTUAL> customComparator, String customComparatorDescription) Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks. The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used. Examples :
| |
| usingDefaultComparator | back to summary |
|---|---|
| public SELF usingDefaultComparator() Revert to standard comparison for the incoming assertion checks.
This method should be used to disable a custom comparison strategy set by calling
| |
| withRepresentation | back to summary |
|---|---|
| public SELF withRepresentation(Representation representation) Use the given
The usual way to introduce a new
You can also control other types format by overriding Example :
| |
| withThreadDumpOnError | back to summary |
|---|---|
| public SELF withThreadDumpOnError() In case of an assertion error, a thread dump will be printed to Example :
will print a thread dump, something similar to this:
| |