Class SmithyTestCase
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Thrown when errors are encountered while unwrapping a test case.static final class
Output of validating a model against a test case. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateResult
(ValidatedResult<Model> validatedResult) Creates a test case result from a test case and validated model.static SmithyTestCase
fromModelFile
(String modelLocation) Creates a test case from a model file.Gets the expected validation events.Gets the location of the model file.
-
Constructor Details
-
SmithyTestCase
- Parameters:
modelLocation
- Location of where the model is stored.expectedEvents
- The expected validation events to encounter.
-
-
Method Details
-
fromModelFile
Creates a test case from a model file.The error file is expected to be stored in the same directory as the model file and is assumed to be named the same as the file with the file extension replaced with ".errors".
The accompanying error file is a newline separated list of error strings, where each error is defined in the following format:
[SEVERITY] shapeId message | EventId filename:line:column
. A shapeId of "-" means that a specific shape is not targeted.- Parameters:
modelLocation
- File location of the model.- Returns:
- Returns the created test case.
- Throws:
IllegalArgumentException
- if the file does not contain an extension.
-
getExpectedEvents
Gets the expected validation events.- Returns:
- Expected validation events.
-
getModelLocation
Gets the location of the model file.- Returns:
- Model location.
-
createResult
Creates a test case result from a test case and validated model.The validation events encountered while validating a model are compared against the expected validation events. An actual event (A) is considered a match with an expected event (E) if A and E target the same shape, use the same validation event ID, have the same severity, and the message of E starts with the suppression reason or message of A.
- Parameters:
validatedResult
- Result of creating and validating the model.- Returns:
- Returns the created test case result.
-