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 MmodelModelloaded for testing.protected OoperationsOperations.-
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> voidassertChange(Change<T> change, T expectedTarget, java.lang.String expectedChangeDescription, boolean expectCanApply, java.lang.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 java.lang.StringgetModelFileExtension()Obtains 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 voiduseTestSetupModel()Allows particular tests of aTestCaseto override using the default setupConfigurationItemand use the specific testConfigurationItem.protected voidvalidateAsSetupModel()protected voidvalidateModel()protected voidvalidateModel(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:
setUpin classjunit.framework.TestCase- Throws:
java.lang.Exception
-
retrieveModel
protected abstract M retrieveModel(ConfigurationItem configurationItem) throws java.lang.Exception
Retrieves theModel.- Parameters:
configurationItem-ConfigurationItemcontaining 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-WritableConfigurationItemto store theModel.- Throws:
java.lang.Exception- If fails to store theModel.
-
createModelOperations
protected abstract O createModelOperations(M model)
Creates theModeloperations.
-
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 aTestCaseto override using the default setupConfigurationItemand 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 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
protected void assertChanges(Change<?>... changes)
Assets all theChangeinstances result in a correct change.- Parameters:
changes-Changeinstances to verify.
-
validateModel
protected void validateModel()
-
validateModel
protected void validateModel(java.lang.String specific)
- Parameters:
specific- Indicates the specificModelfile for the test.
-
validateAsSetupModel
protected void validateAsSetupModel()
-
-