Class Assertions2
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TassertCallEquals(T expected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the callable returns an object equal to the given expected object.static booleanassertCallFalse(ObjectCallable<Boolean> callable, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the callable returnsBoolean.FALSE.static <T> TassertCallNotEquals(T unexpected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the callable returns an object not equal to the given object.static <T> TassertCallNotNull(ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the callable returns an object.static <T> TassertCallNotSame(T unexpected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given callable does not return the given object.static <T> TassertCallNull(ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given callable returns null.static <T> TassertCallSame(T expected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given callable returns the given object.static booleanassertCallTrue(ObjectCallable<Boolean> callable, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the given callable returnsBoolean.TRUE.static <T> TassertEquals(T expected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is equal to the given expected object.static booleanassertFalse(boolean actual, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the callable returnsBoolean.FALSE.static <T> TassertNotEquals(T unexpected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is not equal to the given unexpected object.static <T> TassertNotNull(T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is not null.static <T> TassertNotSame(T unexpected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is not the same as the given unexpected object.static <T> TassertNull(T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is null.static <T> TassertSame(T expected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is the same as the given expected object.static <T extends Exception>
TassertThrows(Class<T> expected, Callable callable, Context context, PreCommentSupplier<? super ResultOfExceptionalCall<T>> preCommentSupplier) Asserts that the given callable throws an exception of the given expected type.static booleanassertTrue(boolean actual, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the given boolean value is true.static voidcall(Callable callable, Context context, PreCommentSupplier<? super ResultOfCall> preCommentSupplier) static <T> TcallObject(ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) static Contextstatic Context.Builder<?>Returns a contexts builder.static ContextReturns an empty contexts.static <T> Tfail(Exception cause, Context context, PreCommentSupplier<? super ResultOfFail> preCommentSupplier) Fails.static <T> Tfail(Context context, PreCommentSupplier<? super ResultOfFail> preCommentSupplier) Fails.static <T> Tfail(Expected expected, Actual actual, Context context, PreCommentSupplier<? super ResultOfFail> preCommentSupplier) static Fail.BuilderReturns a fail builder.static <T> TobjectAssert(ExpectedObject<T> expected, ObjectCallable<T> callable, Context context) static <T> TobjectAssert(ExpectedObject<T> expected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) static <T> TobjectAssert(ExpectedObject<T> expected, ObjectCallable<T> callable, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) static <T> TobjectAssert(ExpectedObject<T> expected, T object, Context context) static <T> TobjectAssert(ExpectedObject<T> expected, T object, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) static <T> TobjectAssert(ExpectedObject<T> expected, T object, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) static TestOfCall.Builderstatic <T> TestOfObject.Builder<T>Returns a object test builder.static <T extends Exception>
TestOfExceptionalCall.Builder<T>Returns a throwable call test builder.
-
Method Details
-
objectAssert
public static <T> T objectAssert(ExpectedObject<T> expected, T object, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) -
objectAssert
-
objectAssert
public static <T> T objectAssert(ExpectedObject<T> expected, T object, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) -
objectAssert
public static <T> T objectAssert(ExpectedObject<T> expected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) -
objectAssert
public static <T> T objectAssert(ExpectedObject<T> expected, ObjectCallable<T> callable, Context context) -
objectAssert
public static <T> T objectAssert(ExpectedObject<T> expected, ObjectCallable<T> callable, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) -
assertCallEquals
public static <T> T assertCallEquals(T expected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the callable returns an object equal to the given expected object.
- Type Parameters:
T- the type of the object- Parameters:
expected- the expected objectcallable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallFalse
public static boolean assertCallFalse(ObjectCallable<Boolean> callable, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the callable returns
Boolean.FALSE.- Parameters:
callable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallNotEquals
public static <T> T assertCallNotEquals(T unexpected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the callable returns an object not equal to the given object.- Type Parameters:
T- the type of the object- Parameters:
unexpected- the unexpected objectcallable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallNotNull
public static <T> T assertCallNotNull(ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the callable returns an object.- Type Parameters:
T- the type of the object- Parameters:
callable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallNotSame
public static <T> T assertCallNotSame(T unexpected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given callable does not return the given object.- Type Parameters:
T- the type of the object- Parameters:
unexpected- the unexpected objectcallable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallNull
public static <T> T assertCallNull(ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given callable returns null.
- Parameters:
callable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallSame
public static <T> T assertCallSame(T expected, ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given callable returns the given object.- Type Parameters:
T- the type of the object- Parameters:
expected- the expected objectcallable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertCallTrue
public static boolean assertCallTrue(ObjectCallable<Boolean> callable, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the given callable returns
Boolean.TRUE.- Parameters:
callable- the callable to retrieve the object fromcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertEquals
public static <T> T assertEquals(T expected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is equal to the given expected object.
- Type Parameters:
T- the type of the object- Parameters:
expected- the expected objectactual- the actual objectcontext- the context of the test- Returns:
- the result of the test
-
assertFalse
public static boolean assertFalse(boolean actual, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the callable returns
Boolean.FALSE.- Parameters:
actual- the actual valuecontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertNotEquals
public static <T> T assertNotEquals(T unexpected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is not equal to the given unexpected object.
- Type Parameters:
T- the type of the object- Parameters:
unexpected- the unexpected objectactual- the actual objectcontext- the context of the test- Returns:
- the result of the test
-
assertNotNull
public static <T> T assertNotNull(T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is not null.
- Type Parameters:
T- the type of the object- Parameters:
actual- the actual objectcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertNotSame
public static <T> T assertNotSame(T unexpected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is not the same as the given unexpected object.
- Type Parameters:
T- the type of the object- Parameters:
unexpected- the unexpected objectactual- the actual objectcontext- the context of the test- Returns:
- the result of the test
-
assertNull
public static <T> T assertNull(T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is null.
- Type Parameters:
T- the type of the object- Parameters:
actual- the actual objectcontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
assertSame
public static <T> T assertSame(T expected, T actual, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) Asserts that the given actual object is the same as the given expected object.
- Type Parameters:
T- the type of the object- Parameters:
expected- the expected objectactual- the actual objectcontext- the context of the test- Returns:
- the result of the test
-
assertThrows
public static <T extends Exception> T assertThrows(Class<T> expected, Callable callable, Context context, PreCommentSupplier<? super ResultOfExceptionalCall<T>> preCommentSupplier) Asserts that the given callable throws an exception of the given expected type.
- Parameters:
expected- the expected type of the exceptioncontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
call
public static void call(Callable callable, Context context, PreCommentSupplier<? super ResultOfCall> preCommentSupplier) -
callObject
public static <T> T callObject(ObjectCallable<T> callable, Context context, PreCommentSupplier<? super ResultOfObject<T>> preCommentSupplier) -
assertTrue
public static boolean assertTrue(boolean actual, Context context, PreCommentSupplier<? super ResultOfObject<Boolean>> preCommentSupplier) Asserts that the given boolean value is true.- Parameters:
actual- the boolean valuecontext- the context of the testpreCommentSupplier- the supplier of the pre-comment- Returns:
- the result of the test
-
contextBuilder
Returns a contexts builder.- Returns:
- the context builder
-
emptyContext
Returns an empty contexts.- Returns:
- the empty context
-
fail
public static <T> T fail(Context context, PreCommentSupplier<? super ResultOfFail> preCommentSupplier) Fails.- Type Parameters:
T- the return type (for convenience reasons)- Parameters:
context- the context of the failpreCommentSupplier- the supplier of the pre-comment- Returns:
- nothing
-
fail
public static <T> T fail(Exception cause, Context context, PreCommentSupplier<? super ResultOfFail> preCommentSupplier) Fails.- Type Parameters:
T- the return type (for convenience reasons)- Parameters:
cause- the cause of the failcontext- the context of the failpreCommentSupplier- the supplier of the pre-comment- Returns:
- nothing
-
fail
public static <T> T fail(Expected expected, Actual actual, Context context, PreCommentSupplier<? super ResultOfFail> preCommentSupplier) -
failBuilder
Returns a fail builder.- Returns:
- the fail builder
-
testOfCallBuilder
-
testOfObjectBuilder
Returns a object test builder.- Returns:
- the object test builder
-
testOfThrowableCallBuilder
Returns a throwable call test builder.- Returns:
- the throwable call test builder
-
context
-