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
Abstract operations
TestCase.- 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 Throwable>, OfficeFrameTestCase.StressTest, OfficeFrameTestCase.TestCapture<T extends Throwable>, OfficeFrameTestCase.TestLogic<R,T extends Throwable>, OfficeFrameTestCase.UsesDockerTest, OfficeFrameTestCase.UsesGCloudTest, OfficeFrameTestCase.WaitForTruePredicate<T extends Throwable> -
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionInitiate.AbstractChangesTestCase(boolean isSpecificSetupFilePerTest) Initiate. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> voidassertChange(Change<T> change, T expectedTarget, String expectedChangeDescription, boolean expectCanApply, String... expectedConflictDescriptions) Asserts theChangeis correct.protected voidassertChanges(Change<?>... changes) Assets all theChangeinstances result in a correct change.protected voidassertModels(M expected, M actual) Asserts the models are the same.protected abstract OcreateModelOperations(M model) Creates theModeloperations.protected abstract StringObtains the extension for the file containing theModel.protected abstract MretrieveModel(ConfigurationItem configurationItem) Retrieves theModel.protected voidsetUp()protected abstract voidstoreModel(M model, WritableConfigurationItem configurationItem) Stores theModel.protected voidAllows particular tests of aTestCaseto override using the default setupConfigurationItemand use the specific testConfigurationItem.protected voidprotected voidprotected voidvalidateModel(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, waitForTrueMethods 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
-
Field Details
-
model
Modelloaded for testing. -
operations
Operations.
-
-
Constructor Details
-
AbstractChangesTestCase
public AbstractChangesTestCase()Initiate. -
AbstractChangesTestCase
public AbstractChangesTestCase(boolean isSpecificSetupFilePerTest) Initiate.- Parameters:
isSpecificSetupFilePerTest- Flags if there is a specific setup file per test.
-
-
Method Details
-
setUp
- Overrides:
setUpin classjunit.framework.TestCase- Throws:
Exception
-
retrieveModel
Retrieves theModel.- Parameters:
configurationItem-ConfigurationItemcontaining theModel.- Returns:
Model.- Throws:
Exception- If fails to retrieve theModel.
-
storeModel
protected abstract void storeModel(M model, WritableConfigurationItem configurationItem) throws Exception Stores theModel.- Parameters:
model-Model.configurationItem-WritableConfigurationItemto store theModel.- Throws:
Exception- If fails to store theModel.
-
createModelOperations
Creates theModeloperations. -
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 aTestCaseto override using the default setupConfigurationItemand use the specific testConfigurationItem. -
assertChange
protected <T> void assertChange(Change<T> change, T expectedTarget, String expectedChangeDescription, boolean expectCanApply, String... expectedConflictDescriptions) Asserts theChangeis correct.- Type Parameters:
T- Expected target.- Parameters:
change-Changeto 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 theConflictinstances on theChange.
-
assertChanges
Assets all theChangeinstances result in a correct change.- Parameters:
changes-Changeinstances to verify.
-
validateModel
protected void validateModel() -
validateModel
- Parameters:
specific- Indicates the specificModelfile for the test.
-
validateAsSetupModel
protected void validateAsSetupModel() -
assertModels
Asserts the models are the same.- Parameters:
expected- Expected model.actual- Actual model.- Throws:
Exception- If fails.
-