public class JaxRsGrounding extends AbstractGrounding
dependency, metaCheck, stepIndex, testIndex, writer
Constructor and Description |
---|
JaxRsGrounding(java.io.PrintWriter stream)
Creates a JaxRsGrounding writing to a stream.
|
Modifier and Type | Method and Description |
---|---|
void |
groundTestSequence(TestSequence sequence)
Translates one abstract TestSequence into a JUnit test-method.
|
void |
groundTestStep(TestStep testStep)
Translates one abstract TestStep into Java set-up and evaluation code.
|
void |
groundTestSuite(TestSuite testSuite)
Translates an abstract TestSuite into a grounded suite of tests.
|
void |
useEndpoint(java.lang.String serviceURI)
Tells this Grounding to use the given root URI as the endpoint.
|
protected void |
writeCallMethod()
Prints out an extra secret method used by the Test Driver to build the
complete URI path for the REST call, make the REST call and extract the
JSON String response.
|
protected void |
writeClassComment(TestSuite testSuite)
Prints out a class-level comment for the JUnit test driver class
source file.
|
protected void |
writeDriverConstructor(TestSuite testSuite)
Prints out the test driver's constructor, with or without the Factory.
|
protected void |
writeDriverFields(TestSuite testSuite)
Prints out the private attributes used by the JUnit Test Driver class.
|
protected void |
writeFailureTestStep(TestStep testStep)
Prints out a method invocation expecting to throw an exception.
|
protected void |
writeInitialTestStep(TestStep testStep)
Optionally prints out an assertion check on the result of the set-up
code that created the service.
|
protected void |
writeInputList(java.util.Set<Input> inputs)
Prints the list of argument value(s) for the operation inputs, in the format
needed for building the URI path for the RESTful service.
|
protected void |
writeMetaDataAssertions(TestStep testStep)
Prints the JUnit assertions checking that the system executed the
expected scenario in this TestStep and ended in the expected state.
|
protected void |
writeNormalTestStep(TestStep testStep)
Prints out a method invocation expecting a normal return value.
|
protected void |
writePackageInfo(TestSuite testSuite)
Prints out package information at the head of the generated JUnit test
driver class source file.
|
protected void |
writeResultVariables(java.util.Set<Output> outputs)
Prints the appropriate kind of receiver variable(s) for the outputs,
and initialises these to the result of decoding the JSON response.
|
protected void |
writeStatusMethods()
Prints out an extra couple of methods used to make status checks on
the service.
|
protected void |
writeSystemSetUp(TestSuite testSuite)
Prints out the set-up method for creating or reseting the System-Under-Test.
|
protected void |
writeVoidAssertion()
Special assertion to check that an operation specified as returning
a void result actually returned nothing useful.
|
setMetaCheck, useSourcePackage, useTargetPackage, writeFactoryValue, writeJavaType, writeJavaValue, writeLiteralValue, writeMethodComment, writeOutputList, writeResultAssertions
public JaxRsGrounding(java.io.PrintWriter stream)
stream
- the output stream.public void groundTestSuite(TestSuite testSuite)
testSuite
- the abstract TestSuite.public void groundTestSequence(TestSequence sequence)
sequence
- the high-level test sequence.public void groundTestStep(TestStep testStep)
testStep
- the high-level test step.protected void writeDriverFields(TestSuite testSuite)
testSuite
- the TestSuite.protected void writeDriverConstructor(TestSuite testSuite)
writeDriverConstructor
in class AbstractGrounding
testSuite
- the TestSuite.protected void writeSystemSetUp(TestSuite testSuite)
testSuite
- the test suite.protected void writeCallMethod()
protected void writeStatusMethods()
protected void writePackageInfo(TestSuite testSuite)
testSuite
- the TestSuite.protected void writeClassComment(TestSuite testSuite)
testSuite
- the TestSuite.protected void writeInitialTestStep(TestStep testStep)
testStep
- the TestStep.protected void writeNormalTestStep(TestStep testStep)
testStep
- the TestStep to translate.protected void writeFailureTestStep(TestStep testStep)
writeFailureTestStep
in class AbstractGrounding
testStep
- the TestStep.public void useEndpoint(java.lang.String serviceURI)
useEndpoint
in interface Grounding
useEndpoint
in class AbstractGrounding
serviceURI
- the root URI of the service.protected void writeInputList(java.util.Set<Input> inputs)
writeInputList
in class AbstractGrounding
inputs
- the ordered set of inputs.protected void writeResultVariables(java.util.Set<Output> outputs)
writeResultVariables
in class AbstractGrounding
outputs
- the ordered set of outputs.protected void writeVoidAssertion()
writeVoidAssertion
in class AbstractGrounding
protected void writeMetaDataAssertions(TestStep testStep)
writeMetaDataAssertions
in class AbstractGrounding
testStep
- the TestStep whose properties are to be asserted.