P
- The type of the parameterT
- the exception type@FunctionalInterface public interface Statement<P,T extends Throwable>
A statement can be used inside test (to isolate a code that must thrown an exception) and are used internally by the framework to compose and execute test sequence element.
Modifier and Type | Method and Description |
---|---|
default Statement<P,T> |
andThenAlways(Statement<P,T> after)
Aggregate this statement and then the following.
|
default Statement<P,T> |
andThenOnlySuccess(Statement<P,T> after)
Aggregate this statement and then the following.
|
static <P,T extends Throwable> |
around(Statement<P,T> internal,
Statement<P,T> before,
Statement<P,T> after)
Build a around statement (do something, then something others, and after
one a third statement, event in case of exception.
|
default String |
getName()
Used to provide a name (for internal use purpose).
|
static <P,T extends Throwable> |
reflectionMethod(Consumer<Object> method,
Object param)
Build a statement based on a method-
|
static <P,T extends Throwable> |
reflectionMethod(Object target,
Method method)
Build a statement based on a method-
|
void |
run(P parameter)
Executable code.
|
void run(P parameter) throws Throwable
parameter
- A parameter for the statementThrowable
- in case of error.default String getName()
default Statement<P,T> andThenAlways(Statement<P,T> after)
after
- the next statementdefault Statement<P,T> andThenOnlySuccess(Statement<P,T> after)
after
- the next statementstatic <P,T extends Throwable> Statement<P,T> around(Statement<P,T> internal, Statement<P,T> before, Statement<P,T> after)
P
- The type of the parameterT
- the exception typeinternal
- the internal partbefore
- the first statementafter
- the last statement, done event in case of exception.static <P,T extends Throwable> Statement<P,T> reflectionMethod(Object target, Method method)
P
- The type of the parameterT
- the exception typetarget
- the target objectmethod
- the methodstatic <P,T extends Throwable> Statement<P,T> reflectionMethod(Consumer<Object> method, Object param)
P
- The type of the parameterT
- the exception typemethod
- the methodparam
- the paramCopyright © 2015 Powerunit. All rights reserved.