AssertionFailedErrors.
Using this builder ensures consistency in how failure message are formatted within JUnit Jupiter and for custom user-defined assertions.
AssertionFailedError
| Modifier and Type | Field and Description |
|---|---|
| private @Nullable Object | |
| private @Nullable Throwable | |
| private @Nullable Object | |
| private boolean | |
| private @Nullable Object | |
| private boolean | |
| private @Nullable String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public AssertionFailureBuilder | |
| public static AssertionFailureBuilder | |
| public AssertionFailedError | |
| public void | |
| private static String | |
| public AssertionFailureBuilder | |
| public AssertionFailureBuilder | |
| private static String | |
| private static String | |
| private static String | |
| public AssertionFailureBuilder | Returns: this builder for method chainingwhether to include the actual and expected
values includeValuesInMessage)Set whether to include the actual and expected values in the generated failure message. |
| public AssertionFailureBuilder | |
| private static @Nullable String | |
| public AssertionFailureBuilder | |
| private static String | |
| private static String |
| actual | back to summary |
|---|---|
| private @Nullable Object actual | |
| cause | back to summary |
|---|---|
| private @Nullable Throwable cause | |
| expected | back to summary |
|---|---|
| private @Nullable Object expected | |
| includeValuesInMessage | back to summary |
|---|---|
| private boolean includeValuesInMessage | |
| message | back to summary |
|---|---|
| private @Nullable Object message | |
| mismatch | back to summary |
|---|---|
| private boolean mismatch | |
| reason | back to summary |
|---|---|
| private @Nullable String reason | |
| AssertionFailureBuilder | back to summary |
|---|---|
| private AssertionFailureBuilder() | |
| actual | back to summary |
|---|---|
| public AssertionFailureBuilder actual(@Nullable Object actual) Set the actual value of the assertion.
| |
| assertionFailure | back to summary |
|---|---|
| public static AssertionFailureBuilder assertionFailure() Create a new | |
| build | back to summary |
|---|---|
| public AssertionFailedError build() Build the
| |
| buildAndThrow | back to summary |
|---|---|
| public void buildAndThrow() throws AssertionFailedError Build the
| |
| buildPrefix | back to summary |
|---|---|
| private static String buildPrefix(@Nullable String message) | |
| cause | back to summary |
|---|---|
| public AssertionFailureBuilder cause(@Nullable Throwable cause) Set the cause of the assertion failure.
| |
| expected | back to summary |
|---|---|
| public AssertionFailureBuilder expected(@Nullable Object expected) Set the expected value of the assertion.
| |
| formatClassAndValue | back to summary |
|---|---|
| private static String formatClassAndValue(@Nullable Object value, String valueString) | |
| formatValues | back to summary |
|---|---|
| private static String formatValues(@Nullable Object expected, @Nullable Object actual) | |
| getClassName | back to summary |
|---|---|
| private static String getClassName(@Nullable Object obj) | |
| includeValuesInMessage | back to summary |
|---|---|
| public AssertionFailureBuilder includeValuesInMessage(boolean includeValuesInMessage) Set whether to include the actual and expected values in the generated failure message.
| |
| message | back to summary |
|---|---|
| public AssertionFailureBuilder message(@Nullable Object message) Set the user-defined message of the assertion. The
| |
| nullSafeGet | back to summary |
|---|---|
| private static @Nullable String nullSafeGet(@Nullable Object messageOrSupplier) | |
| reason | back to summary |
|---|---|
| public AssertionFailureBuilder reason(@Nullable String reason) Set the reason why the assertion failed.
| |
| toHash | back to summary |
|---|---|
| private static String toHash(@Nullable Object obj) | |
| toString | back to summary |
|---|---|
| private static String toString(@Nullable Object obj) | |