Package net.officefloor.test
Class AbstractOfficeFloorJUnit
java.lang.Object
net.officefloor.test.AbstractOfficeFloorJUnit
- All Implemented Interfaces:
OfficeFloorJUnit
- Direct Known Subclasses:
OfficeFloorRule
Abstract JUnit functionality for
OfficeFloor.- Author:
- Daniel Sagenschneider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTestDependencyService(TestDependencyService testDependencyService) Adds aTestDependencyService.protected voidafterAll()Undertakes the after all logic.protected voidUndertakes the after each logic.protected voidUndertakes the before all logic.protected voidbeforeEach(Object testInstance) Undertakes the before each logic.protected voidCloses theOfficeFloor.protected abstract voidUndertake JUnit version specific fail.protected abstract ErrorUndertake JUnit version specific fail.protected ObjectgetDependency(FromOffice fromOffice, StatePoint statePoint) Obtains the qualifier for theStatePoint.Obtains theOfficeFloor.protected List<TestDependencyService>Obtains the ordered list ofTestDependencyServiceinstances.protected Consumer<OfficeFloor>Initialises theOfficeFloorCompiler.voidinvokeProcess(String functionName, Object parameter) voidinvokeProcess(String functionName, Object parameter, long waitTime) voidinvokeProcess(String officeName, String functionName, Object parameter, long waitTime) Convenience method to invoke theProcessStatefor theManagedFunction.protected booleanisDependencyAvailable(FromOffice fromOffice, StatePoint statePoint) Determines if the dependency is available.protected voidOpens theOfficeFloor.protected voidsetDependencyLoadTimeout(long dependencyLoadTimeout) Specifies the dependency load timeout.
-
Constructor Details
-
AbstractOfficeFloorJUnit
public AbstractOfficeFloorJUnit()
-
-
Method Details
-
addTestDependencyService
Adds aTestDependencyService.- Parameters:
testDependencyService-TestDependencyService.
-
doFail
Undertake JUnit version specific fail.- Parameters:
message- Message for the fail.
-
doFail
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
Undertakes the before all logic.- Throws:
Exception- If fails.
-
beforeEach
Undertakes the before each logic.- Parameters:
testInstance- Test instance.- Throws:
Exception- If fails.
-
afterEach
Undertakes the after each logic.- Throws:
Exception- If fails.
-
afterAll
Undertakes the after all logic.- Throws:
Exception- If fails.
-
initialiseOfficeFloorCompiler
Initialises theOfficeFloorCompiler.- Parameters:
compiler-OfficeFloorCompiler.- Returns:
Consumerto load the openedOfficeFloor.
-
openOfficeFloor
Opens theOfficeFloor.- Throws:
Exception- If fails to open theOfficeFloor.
-
isDependencyAvailable
protected boolean isDependencyAvailable(FromOffice fromOffice, StatePoint statePoint) throws Exception Determines if the dependency is available.- Parameters:
fromOffice-FromOffice.statePoint-StatePoint.- Returns:
trueif the dependency is available.- Throws:
Exception- If fails to determine dependency available.
-
getDependency
Obtains the qualifier for theStatePoint.- Parameters:
fromOffice-FromOffice.statePoint-StatePoint.- Returns:
- Dependency.
- Throws:
Exception- If fails to obtain the dependency.
-
getTestDependencyServices
Obtains the ordered list ofTestDependencyServiceinstances.- Returns:
- Ordered list of
TestDependencyServiceinstances.
-
closeOfficeFloor
Closes theOfficeFloor.- Throws:
Exception- If fails to close theOfficeFloor.
-
getOfficeFloor
Description copied from interface:OfficeFloorJUnitObtains theOfficeFloor.- Specified by:
getOfficeFloorin interfaceOfficeFloorJUnit- Returns:
OfficeFloor.
-
invokeProcess
Description copied from interface:OfficeFloorJUnit- Specified by:
invokeProcessin interfaceOfficeFloorJUnit- Parameters:
functionName- Name of theManagedFunction.parameter- Parameter to theManagedFunction.
-
invokeProcess
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
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.
-