public abstract class OperationTest extends ConnectorTest
ConnectorTester
. All implementing classes will execute
a single test to verify successful execution of the operation.
To create tests for specific operations, you should extend the operation specific subclasses instead of implementing this directly.
Modifier and Type | Field and Description |
---|---|
protected static int |
EXPECTED_RESULT_COUNT |
connectorTester, testContext
Modifier | Constructor and Description |
---|---|
protected |
OperationTest(OperationType operationType,
String objectTypeId)
Creates an instance of an operation test.
|
protected |
OperationTest(OperationType operationType,
String objectTypeId,
OptionalTestInput optionalTestInput)
Creates an instance of an operation test.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterOperation(List<SimpleOperationResult> results)
This method can be overridden to provide additional verification beyond the base verifications performed by
testOperation() . |
protected void |
afterOperation(SimpleOperationResult result)
This method can be overridden to provide additional verification beyond the base verifications performed by
testOperation() . |
protected abstract List<SimpleOperationResult> |
executeOperation()
This method should perform the actual operation being tested
|
void |
prepareForOperation()
Setup method for operation tests
|
void |
testOperation()
Test method to verify the successful execution of the target operation
|
browseProfile, browseTypes, clearObjectDefinitionCache, getBrowseContext, getConnectorTestContext, getOperationContext, setupConnectorTester
protected static final int EXPECTED_RESULT_COUNT
protected OperationTest(OperationType operationType, String objectTypeId)
Intended to be used as part of a Parameterized
test but can be run as a single test instance by invoking
this constructor from the no argument constructor of the implementing class.
operationType
- the operation under testobjectTypeId
- the object type id under testprotected OperationTest(OperationType operationType, String objectTypeId, OptionalTestInput optionalTestInput)
Intended to be used as part of a Parameterized
test but can be run as a single test instance by invoking
this constructor from the no argument constructor of the implementing class.
operationType
- the operation under testobjectTypeId
- the object type id under testoptionalTestInput
- optional input for the testpublic final void prepareForOperation()
This method will set the object type and object type id in the test context. It will also verify that any
ObjectDefinitionRole
cookies have been loaded.
public final void testOperation() throws Exception
The test will execute the operation specified by the implementing class and verify the
SimpleOperationResult
. Successful operations are assumed to have only a single result as the test only
supports a single input value. The operation status and presence of payloads will be verified against
expectedOperationStatus
and expectedEmptyPayloads
. The expected values are specified by
OptionalTestInput
and default to OperationStatus.SUCCESS
and false
, respectively. If
payloads are expected, they should not be null
.
Exception
- exception testing the operationprotected void afterOperation(List<SimpleOperationResult> results) throws Exception
testOperation()
. This method will only execute after other verifications have passed. The default
behavior of this method is to pass the first item in the list to afterOperation(SimpleOperationResult)
.results
- list of results created by executing the operationException
- execption validating the operation resultsprotected void afterOperation(SimpleOperationResult result) throws Exception
testOperation()
. This method will only execute after other verifications have passed. If
afterOperation(SimpleOperationResult)
has also been overridden, then it is the responsibility of the
overriding class to ensure that this method is called (if needed).result
- SimpleOperationResult
created by executing the operationException
- exception validating the operation resultprotected abstract List<SimpleOperationResult> executeOperation()
List
of SimpleOperationResult
representing the result of the operation