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 void
afterAll()
Undertakes the after all logic.protected void
afterEach()
Undertakes the after each logic.protected void
beforeAll()
Undertakes the before all logic.protected void
beforeEach(java.lang.Object testInstance)
Undertakes the before each logic.protected void
closeOfficeFloor()
Closes theOfficeFloor
.protected abstract void
doFail(java.lang.String message)
Undertake JUnit version specific fail.protected abstract java.lang.Error
doFail(java.lang.Throwable cause)
Undertake JUnit version specific fail.protected java.lang.Object
getDependency(FromOffice fromOffice, StatePoint statePoint)
Obtains the qualifier for theStatePoint
.OfficeFloor
getOfficeFloor()
Obtains theOfficeFloor
.protected java.util.function.Consumer<OfficeFloor>
initialiseOfficeFloorCompiler(OfficeFloorCompiler compiler)
Initialises theOfficeFloorCompiler
.void
invokeProcess(java.lang.String functionName, java.lang.Object parameter)
void
invokeProcess(java.lang.String functionName, java.lang.Object parameter, long waitTime)
void
invokeProcess(java.lang.String officeName, java.lang.String functionName, java.lang.Object parameter, long waitTime)
Convenience method to invoke theProcessState
for theManagedFunction
.protected boolean
isDependencyAvailable(FromOffice fromOffice, StatePoint statePoint)
Determines if the dependency is available.protected void
openOfficeFloor()
Opens theOfficeFloor
.protected void
setDependencyLoadTimeout(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:
Error
to propagate.
-
setDependencyLoadTimeout
protected void setDependencyLoadTimeout(long dependencyLoadTimeout)
Specifies the dependency load timeout.- Parameters:
dependencyLoadTimeout
- Dependency load timeout.
-
beforeAll
protected void beforeAll() throws java.lang.Exception
Undertakes the before all logic.- Throws:
java.lang.Exception
- If fails.
-
beforeEach
protected void beforeEach(java.lang.Object testInstance) throws java.lang.Exception
Undertakes the before each logic.- Parameters:
testInstance
- Test instance.- Throws:
java.lang.Exception
- If fails.
-
afterEach
protected void afterEach() throws java.lang.Exception
Undertakes the after each logic.- Throws:
java.lang.Exception
- If fails.
-
afterAll
protected void afterAll() throws java.lang.Exception
Undertakes 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:
Consumer
to load the openedOfficeFloor
.
-
openOfficeFloor
protected void openOfficeFloor() throws java.lang.Exception
Opens 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:
true
if 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.Exception
Closes theOfficeFloor
.- Throws:
java.lang.Exception
- If fails to close theOfficeFloor
.
-
getOfficeFloor
public OfficeFloor getOfficeFloor()
Description copied from interface:OfficeFloorJUnit
Obtains theOfficeFloor
.- Specified by:
getOfficeFloor
in interfaceOfficeFloorJUnit
- Returns:
OfficeFloor
.
-
invokeProcess
public void invokeProcess(java.lang.String functionName, java.lang.Object parameter)
Description copied from interface:OfficeFloorJUnit
- Specified by:
invokeProcess
in 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:
invokeProcess
in interfaceOfficeFloorJUnit
- Parameters:
functionName
- Name of theManagedFunction
.parameter
- Parameter to theManagedFunction
.waitTime
- Time in milliseconds to wait forProcessState
to complete.
-
invokeProcess
public void invokeProcess(java.lang.String officeName, java.lang.String functionName, java.lang.Object parameter, long waitTime)
Description copied from interface:OfficeFloorJUnit
Convenience method to invoke theProcessState
for theManagedFunction
.- Specified by:
invokeProcess
in interfaceOfficeFloorJUnit
- Parameters:
officeName
- Name of theOffice
containing theManagedFunction
.functionName
- Name of theManagedFunction
.parameter
- Parameter to theManagedFunction
.waitTime
- Time in milliseconds to wait forProcessState
to complete.
-
-