Class AbstractProcess<T,U>
- java.lang.Object
-
- net.avcompris.base.testutil.processes.AbstractProcess<T,U>
-
- Type Parameters:
T
- the type of objects to be set as "current" during processing.U
- the type the process returns.
public abstract class AbstractProcess<T,U> extends java.lang.Object
You should inherit this class when you want to use a process in your tests.- Author:
- David Andrianavalontsalama
-
-
Constructor Summary
Constructors Constructor Description AbstractProcess()
-
Method Summary
Modifier and Type Method Description abstract void
execute()
This method is to be overrided to execute the process.abstract U
getResult()
This method is to be overrided for processes to return their results.void
init()
This method is to be overrided for process initialization, if needed.void
release()
This method is to be overrided to release resources after process is done, if needed.protected void
setCurrent(T current)
Process implementations must call this protected method to set the "current" object that tests annotated with @WhileProcessing
will want to use via theTestsWithProcessesBefore.getProcessCurrent(Class)
method.
-
-
-
Method Detail
-
init
public void init() throws java.lang.Exception
This method is to be overrided for process initialization, if needed.Symmetric method is
release()
.- Throws:
java.lang.Exception
-
release
public void release() throws java.lang.Exception
This method is to be overrided to release resources after process is done, if needed.Symmetric method is
init()
.- Throws:
java.lang.Exception
-
execute
public abstract void execute() throws java.lang.Exception
This method is to be overrided to execute the process.- Throws:
java.lang.Exception
-
setCurrent
protected final void setCurrent(T current)
Process implementations must call this protected method to set the "current" object that tests annotated with @WhileProcessing
will want to use via theTestsWithProcessesBefore.getProcessCurrent(Class)
method.- Parameters:
current
- the "current" object to pass to tests.
-
getResult
public abstract U getResult()
This method is to be overrided for processes to return their results.- Returns:
- the result of the process.
-
-