Class AbstractChangesTestCase<M extends Model,O>
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- net.officefloor.frame.test.OfficeFrameTestCase
-
- net.officefloor.model.test.changes.AbstractChangesTestCase<M,O>
-
- All Implemented Interfaces:
junit.framework.Test
public abstract class AbstractChangesTestCase<M extends Model,O> extends OfficeFrameTestCase
Abstract operationsTestCase
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.test.OfficeFrameTestCase
OfficeFrameTestCase.FailOperation, OfficeFrameTestCase.GuiTest, OfficeFrameTestCase.MultithreadedTestLogic<T extends java.lang.Throwable>, OfficeFrameTestCase.StressTest, OfficeFrameTestCase.TestCapture<T extends java.lang.Throwable>, OfficeFrameTestCase.TestLogic<R,T extends java.lang.Throwable>, OfficeFrameTestCase.UsesDockerTest, OfficeFrameTestCase.UsesGCloudTest, OfficeFrameTestCase.WaitForTruePredicate<T extends java.lang.Throwable>
-
-
Field Summary
Fields Modifier and Type Field Description protected M
model
Model
loaded for testing.protected O
operations
Operations.-
Fields inherited from class net.officefloor.frame.test.OfficeFrameTestCase
CLASS_LOADER_EXTRA_CLASS_NAME, CLASS_LOADER_EXTRA_PACKAGE_NAME, classLoaderTestSupport, END_OF_LINE, fileTestSupport, logTestSupport, mockTestSupport, threadedTestSupport
-
-
Constructor Summary
Constructors Constructor Description AbstractChangesTestCase()
Initiate.AbstractChangesTestCase(boolean isSpecificSetupFilePerTest)
Initiate.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <T> void
assertChange(Change<T> change, T expectedTarget, java.lang.String expectedChangeDescription, boolean expectCanApply, java.lang.String... expectedConflictDescriptions)
Asserts theChange
is correct.protected void
assertChanges(Change<?>... changes)
Assets all theChange
instances result in a correct change.protected void
assertModels(M expected, M actual)
Asserts the models are the same.protected abstract O
createModelOperations(M model)
Creates theModel
operations.protected abstract java.lang.String
getModelFileExtension()
Obtains the extension for the file containing theModel
.protected abstract M
retrieveModel(ConfigurationItem configurationItem)
Retrieves theModel
.protected void
setUp()
protected abstract void
storeModel(M model, WritableConfigurationItem configurationItem)
Stores theModel
.protected void
useTestSetupModel()
Allows particular tests of aTestCase
to override using the default setupConfigurationItem
and use the specific testConfigurationItem
.protected void
validateAsSetupModel()
protected void
validateModel()
protected void
validateModel(java.lang.String specific)
-
Methods inherited from class net.officefloor.frame.test.OfficeFrameTestCase
assertContents, assertContents, assertFail, assertFail, assertFail, assertGraph, assertList, assertList, assertList, assertList, assertList, assertProperties, assertTextEquals, assertXmlEquals, captureLoggerOutput, clearDirectory, copyDirectory, createFile, createMock, createNewClassLoader, createPlatformIndependentText, createSynchronizedMock, deleteDirectory, displayGraph, displayGraph, doMultiThreadedTest, doMultiThreadedTest, doTest, fail, findFile, findFile, findInputStream, getDisplayRunTime, getDisplayRunTime, getFileContents, getFileLocation, getItem, getPackageRelativePath, getProperty, isGuiAvailable, isPrintMessages, isSkipStressTests, isSkipTestsUsingDocker, isSkipTestsUsingGCloud, param, paramType, printHeapMemoryDiagnostics, printMessage, printMessage, printMessage, recordReturn, recordReturn, recordThrows, recordVoid, removeXmlWhiteSpacing, replayMockObjects, runBare, setDebugVerbose, setLogGC, setName, setVerbose, sleep, throwException, timeout, timeout, verifyMockObjects, waitForTrue, waitForTrue
-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, tearDown, toString
-
-
-
-
Method Detail
-
setUp
protected void setUp() throws java.lang.Exception
- Overrides:
setUp
in classjunit.framework.TestCase
- Throws:
java.lang.Exception
-
retrieveModel
protected abstract M retrieveModel(ConfigurationItem configurationItem) throws java.lang.Exception
Retrieves theModel
.- Parameters:
configurationItem
-ConfigurationItem
containing theModel
.- Returns:
Model
.- Throws:
java.lang.Exception
- If fails to retrieve theModel
.
-
storeModel
protected abstract void storeModel(M model, WritableConfigurationItem configurationItem) throws java.lang.Exception
Stores theModel
.- Parameters:
model
-Model
.configurationItem
-WritableConfigurationItem
to store theModel
.- Throws:
java.lang.Exception
- If fails to store theModel
.
-
createModelOperations
protected abstract O createModelOperations(M model)
Creates theModel
operations.
-
getModelFileExtension
protected abstract java.lang.String getModelFileExtension()
Obtains the extension for the file containing theModel
.- Returns:
- Extension for the file containing the
Model
.
-
useTestSetupModel
protected void useTestSetupModel()
Allows particular tests of aTestCase
to override using the default setupConfigurationItem
and use the specific testConfigurationItem
.
-
assertChange
protected <T> void assertChange(Change<T> change, T expectedTarget, java.lang.String expectedChangeDescription, boolean expectCanApply, java.lang.String... expectedConflictDescriptions)
Asserts theChange
is correct.- Type Parameters:
T
- Expected target.- Parameters:
change
-Change
to verify.expectedTarget
- Expected target.expectedChangeDescription
- Expected description of theChange
.expectCanApply
- Expected if can apply theChange
. Should it be able to be applied, both theChange.apply()
andChange.revert()
will be also tested.expectedConflictDescriptions
- Expected descriptions for theConflict
instances on theChange
.
-
assertChanges
protected void assertChanges(Change<?>... changes)
Assets all theChange
instances result in a correct change.- Parameters:
changes
-Change
instances to verify.
-
validateModel
protected void validateModel()
-
validateModel
protected void validateModel(java.lang.String specific)
- Parameters:
specific
- Indicates the specificModel
file for the test.
-
validateAsSetupModel
protected void validateAsSetupModel()
-
-