public abstract class AbstractGrounding extends java.lang.Object implements Grounding
Modifier and Type | Field and Description |
---|---|
protected JavaDependency |
dependency
Records package dependencies submitted by the end-user, so that the
standard JavaFactory can create instances of these types.
|
protected boolean |
metaCheck
Boolean flag indicating whether to check full meta-information for
triggered operation scenarios and reached states.
|
protected int |
stepIndex
The counter for TestSteps.
|
protected int |
testIndex
The counter for TestSequences.
|
protected java.io.PrintWriter |
writer
The output stream to which this Grounding writes generated code.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractGrounding(java.io.PrintWriter stream)
Creates an AbstractGrounding writing to a stream.
|
Modifier and Type | Method and Description |
---|---|
void |
setMetaCheck(boolean value)
Sets whether to generate full checks for service meta-data, such as
the name of the last triggered scenario, or the last reached state.
|
void |
useEndpoint(java.lang.String serviceURI)
Tells this Grounding to use the given root URI as the endpoint for the
service (optional).
|
void |
useSourcePackage(java.lang.String packageInfo)
Sets the name of the source Java package for the System-Under-Test.
|
void |
useTargetPackage(java.lang.String packageInfo)
Sets the name of the target Java package for the JUnit Test Driver.
|
protected void |
writeDriverConstructor(TestSuite testSuite)
Prints out the test driver's constructor, with or without the Factory.
|
protected void |
writeFactoryValue(Parameter parameter)
Prints out a factory expression to create the value of a complex
Input or Output parameter.
|
protected void |
writeFailureTestStep(TestStep testStep)
Prints out a method invocation expecting to throw an exception.
|
protected void |
writeInputList(java.util.Set<Input> inputs)
Prints the list of argument value(s) for the operation inputs.
|
protected void |
writeJavaType(Parameter parameter)
Prints the type name of a Parameter as a Java type.
|
protected void |
writeJavaValue(Parameter parameter)
Grounds the value of an Input or Output parameter.
|
protected void |
writeLiteralValue(Parameter parameter)
Prints out the literal value of a simple Input or Output parameter.
|
protected void |
writeMetaDataAssertions(TestStep testStep)
Prints the JUnit assertions checking that the system executed the
expected scenario and ended in the expected state.
|
protected void |
writeMethodComment(TestSequence sequence)
Prints out a method-level comment for one test-method of the JUnit
driver class source file.
|
protected void |
writeOutputList(java.util.Set<Output> outputs)
Prints the initialisation list of literalTypes values for complex outputs.
|
protected void |
writeResultAssertions(java.util.Set<Output> outputs)
Prints the JUnit assertion(s) checking that the expected and actual
result(s) corresponded.
|
protected void |
writeResultVariables(java.util.Set<Output> outputs)
Prints the appropriate kind of receiver variable(s) for the outputs.
|
protected void |
writeVoidAssertion()
Placeholder method for subclasses to override if they must check that
the result from a call was void.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
groundTestSequence, groundTestStep, groundTestSuite
protected JavaDependency dependency
protected java.io.PrintWriter writer
protected boolean metaCheck
protected int testIndex
protected int stepIndex
protected AbstractGrounding(java.io.PrintWriter stream)
stream
- the output stream.public void useTargetPackage(java.lang.String packageInfo)
useTargetPackage
in interface Grounding
packageInfo
- the Test Driver package name.public void useSourcePackage(java.lang.String packageInfo)
useSourcePackage
in interface Grounding
packageInfo
- the Service package name.public void useEndpoint(java.lang.String serviceURI)
useEndpoint
in interface Grounding
serviceURI
- the root URI of the service.public void setMetaCheck(boolean value)
setMetaCheck
in interface Grounding
value
- true, to enable full checks of service meta-data; false
to disable such checks for services that do not reveal this meta-data.protected void writeDriverConstructor(TestSuite testSuite)
testSuite
- the TestSuite.protected void writeMethodComment(TestSequence sequence)
sequence
- the TestSequenceprotected void writeFailureTestStep(TestStep testStep)
testStep
- the TestStep.protected void writeResultVariables(java.util.Set<Output> outputs)
outputs
- the ordered set of outputs.protected void writeInputList(java.util.Set<Input> inputs)
inputs
- the ordered set of inputs.protected void writeOutputList(java.util.Set<Output> outputs)
outputs
- the ordered set of outputs.protected void writeJavaType(Parameter parameter)
parameter
- any Input or Output parameter.protected void writeJavaValue(Parameter parameter)
parameter
- any Input or Output parameter.protected void writeLiteralValue(Parameter parameter)
parameter
- any simple Input or Output parameter.protected void writeFactoryValue(Parameter parameter)
parameter
- any complex Input or Output parameter.protected void writeResultAssertions(java.util.Set<Output> outputs)
outputs
- the expected set of outputs.protected void writeVoidAssertion()
protected void writeMetaDataAssertions(TestStep testStep)
testStep
- the TestStep to be asserted.