Package net.officefloor.test
Class AbstractOfficeFloorJUnit
- java.lang.Object
-
- net.officefloor.test.AbstractOfficeFloorJUnit
-
- All Implemented Interfaces:
OfficeFloorJUnit
- Direct Known Subclasses:
OfficeFloorRule
public abstract class AbstractOfficeFloorJUnit extends java.lang.Object implements OfficeFloorJUnit
Abstract JUnit functionality forOfficeFloor.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description AbstractOfficeFloorJUnit()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidafterAll()Undertakes the after all logic.protected voidafterEach()Undertakes the after each logic.protected voidbeforeAll()Undertakes the before all logic.protected voidbeforeEach(java.lang.Object testInstance)Undertakes the before each logic.protected voidcloseOfficeFloor()Closes theOfficeFloor.protected abstract voiddoFail(java.lang.String message)Undertake JUnit version specific fail.protected abstract java.lang.ErrordoFail(java.lang.Throwable cause)Undertake JUnit version specific fail.protected java.lang.ObjectgetDependency(FromOffice fromOffice, StatePoint statePoint)Obtains the qualifier for theStatePoint.OfficeFloorgetOfficeFloor()Obtains theOfficeFloor.protected java.util.function.Consumer<OfficeFloor>initialiseOfficeFloorCompiler(OfficeFloorCompiler compiler)Initialises theOfficeFloorCompiler.voidinvokeProcess(java.lang.String functionName, java.lang.Object parameter)voidinvokeProcess(java.lang.String functionName, java.lang.Object parameter, long waitTime)voidinvokeProcess(java.lang.String officeName, java.lang.String functionName, java.lang.Object parameter, long waitTime)Convenience method to invoke theProcessStatefor theManagedFunction.protected booleanisDependencyAvailable(FromOffice fromOffice, StatePoint statePoint)Determines if the dependency is available.protected voidopenOfficeFloor()Opens theOfficeFloor.protected voidsetDependencyLoadTimeout(long dependencyLoadTimeout)Specifies the dependency load timeout.
-
-
-
Method Detail
-
doFail
protected abstract void doFail(java.lang.String message)
Undertake JUnit version specific fail.- Parameters:
message- Message for the fail.
-
doFail
protected abstract java.lang.Error doFail(java.lang.Throwable cause)
Undertake JUnit version specific fail.- Parameters:
cause- Cause of the failure.- Returns:
Errorto propagate.
-
setDependencyLoadTimeout
protected void setDependencyLoadTimeout(long dependencyLoadTimeout)
Specifies the dependency load timeout.- Parameters:
dependencyLoadTimeout- Dependency load timeout.
-
beforeAll
protected void beforeAll() throws java.lang.ExceptionUndertakes the before all logic.- Throws:
java.lang.Exception- If fails.
-
beforeEach
protected void beforeEach(java.lang.Object testInstance) throws java.lang.ExceptionUndertakes the before each logic.- Parameters:
testInstance- Test instance.- Throws:
java.lang.Exception- If fails.
-
afterEach
protected void afterEach() throws java.lang.ExceptionUndertakes the after each logic.- Throws:
java.lang.Exception- If fails.
-
afterAll
protected void afterAll() throws java.lang.ExceptionUndertakes the after all logic.- Throws:
java.lang.Exception- If fails.
-
initialiseOfficeFloorCompiler
protected java.util.function.Consumer<OfficeFloor> initialiseOfficeFloorCompiler(OfficeFloorCompiler compiler)
Initialises theOfficeFloorCompiler.- Parameters:
compiler-OfficeFloorCompiler.- Returns:
Consumerto load the openedOfficeFloor.
-
openOfficeFloor
protected void openOfficeFloor() throws java.lang.ExceptionOpens theOfficeFloor.- Throws:
java.lang.Exception- If fails to open theOfficeFloor.
-
isDependencyAvailable
protected boolean isDependencyAvailable(FromOffice fromOffice, StatePoint statePoint) throws java.lang.Exception
Determines if the dependency is available.- Parameters:
fromOffice-FromOffice.statePoint-StatePoint.- Returns:
trueif the dependency is available.- Throws:
java.lang.Exception- If fails to determine dependency available.
-
getDependency
protected java.lang.Object getDependency(FromOffice fromOffice, StatePoint statePoint) throws java.lang.Exception
Obtains the qualifier for theStatePoint.- Parameters:
fromOffice-FromOffice.statePoint-StatePoint.- Returns:
- Dependency.
- Throws:
java.lang.Exception- If fails to obtain the dependency.
-
closeOfficeFloor
protected void closeOfficeFloor() throws java.lang.ExceptionCloses theOfficeFloor.- Throws:
java.lang.Exception- If fails to close theOfficeFloor.
-
getOfficeFloor
public OfficeFloor getOfficeFloor()
Description copied from interface:OfficeFloorJUnitObtains theOfficeFloor.- Specified by:
getOfficeFloorin interfaceOfficeFloorJUnit- Returns:
OfficeFloor.
-
invokeProcess
public void invokeProcess(java.lang.String functionName, java.lang.Object parameter)Description copied from interface:OfficeFloorJUnit- Specified by:
invokeProcessin interfaceOfficeFloorJUnit- Parameters:
functionName- Name of theManagedFunction.parameter- Parameter to theManagedFunction.
-
invokeProcess
public void invokeProcess(java.lang.String functionName, java.lang.Object parameter, long waitTime)Description copied from interface:OfficeFloorJUnit- Specified by:
invokeProcessin interfaceOfficeFloorJUnit- Parameters:
functionName- Name of theManagedFunction.parameter- Parameter to theManagedFunction.waitTime- Time in milliseconds to wait forProcessStateto complete.
-
invokeProcess
public void invokeProcess(java.lang.String officeName, java.lang.String functionName, java.lang.Object parameter, long waitTime)Description copied from interface:OfficeFloorJUnitConvenience method to invoke theProcessStatefor theManagedFunction.- Specified by:
invokeProcessin interfaceOfficeFloorJUnit- Parameters:
officeName- Name of theOfficecontaining theManagedFunction.functionName- Name of theManagedFunction.parameter- Parameter to theManagedFunction.waitTime- Time in milliseconds to wait forProcessStateto complete.
-
-