Class TestReader
java.lang.Object
org.locationtech.jtstest.testrunner.TestReader
- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GeometryFactory
private GeometryOperation
(package private) Vector
private ResultMatcher
private static final String
private static final String
private double
private WKTOrWKBReader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate File
absoluteWktFile
(File wktFile, TestRun testRun) void
private PrecisionModel
createPrecisionModel
(org.jdom2.Element precisionModelElement) createTestRun
(File testFile, int runIndex) static List
getContents
(String textFileName) Returns a List of the String's in the text file, one per line.private Object
getInstance
(String classname, Class baseClass) Gets an instance of a class with the given name, and ensures that the class is assignable to a specified baseClass.boolean
isBooleanFunction
(String name) boolean
isDoubleFunction
(String name) boolean
isGeometryFunction
(String name) boolean
isIntegerFunction
(String name) private GeometryOperation
parseGeometryOperation
(org.jdom2.Element runElement) Parses an optional geometryOperation element.private PrecisionModel
parsePrecisionModel
(org.jdom2.Element runElement) Parses an optional precisionModel element.private ResultMatcher
parseResultMatcher
(org.jdom2.Element runElement) Parses an optional resultMatcher element.private List
parseTestCases
(List caseElements, File testFile, TestRun testRun, double tolerance) Creates a List of TestCase's from the givenElement's. private TestRun
parseTestRun
(org.jdom2.Element runElement, File testFile, int runIndex) Creates a TestRun from theElement. private List
parseTests
(List testElements, int caseIndex, File testFile, TestCase testCase, double tolerance) Creates a List of Test's from the givenElement's. private double
parseTolerance
(org.jdom2.Element runElement) private Geometry
readGeometry
(org.jdom2.Element geometryElement, File wktFile) private BooleanResult
toBooleanResult
(String value) private DoubleResult
toDoubleResult
(String value) private GeometryResult
toGeometryResult
(String value, TestRun testRun) private IntegerResult
toIntegerResult
(String value) private Result
private String
private File
-
Field Details
-
TAG_geometryOperation
- See Also:
-
TAG_resultMatcher
- See Also:
-
parsingProblems
Vector parsingProblems -
geometryFactory
-
wktorbReader
-
tolerance
private double tolerance -
geomOp
-
resultMatcher
-
-
Constructor Details
-
TestReader
public TestReader()
-
-
Method Details
-
getGeometryOperation
-
isBooleanFunction
-
isIntegerFunction
-
isDoubleFunction
-
isGeometryFunction
-
getParsingProblems
-
clearParsingProblems
public void clearParsingProblems() -
createTestRun
-
parseTests
private List parseTests(List testElements, int caseIndex, File testFile, TestCase testCase, double tolerance) throws TestParseException Creates a List of Test's from the givenElement's. - Throws:
TestParseException
-
toResult
private Result toResult(String value, String name, TestRun testRun) throws TestParseException, ParseException - Throws:
TestParseException
ParseException
-
toBooleanResult
- Throws:
TestParseException
-
toDoubleResult
- Throws:
TestParseException
-
toIntegerResult
- Throws:
TestParseException
-
toGeometryResult
- Throws:
ParseException
-
parseTestCases
private List parseTestCases(List caseElements, File testFile, TestRun testRun, double tolerance) throws TestParseException Creates a List of TestCase's from the givenElement's. - Throws:
TestParseException
-
parseTestRun
private TestRun parseTestRun(org.jdom2.Element runElement, File testFile, int runIndex) throws TestParseException Creates a TestRun from theElement. - Throws:
TestParseException
-
parsePrecisionModel
Parses an optional precisionModel element. The default is to use a FLOATING model.- Parameters:
runElement
-- Returns:
- a PrecisionModel instance (default if not specified)
- Throws:
TestParseException
-
createPrecisionModel
private PrecisionModel createPrecisionModel(org.jdom2.Element precisionModelElement) throws TestParseException - Throws:
TestParseException
-
parseGeometryOperation
private GeometryOperation parseGeometryOperation(org.jdom2.Element runElement) throws TestParseException Parses an optional geometryOperation element. The default is to leave this unspecified .- Parameters:
runElement
-- Returns:
- an instance of the GeometryOperation class, if specified, or null if no geometry operation was specified
- Throws:
TestParseException
- if a parsing error was encountered
-
parseResultMatcher
Parses an optional resultMatcher element. The default is to leave this unspecified .- Parameters:
runElement
-- Returns:
- an instance of the ResultMatcher class, if specified, or null if no result matcher was specified
- Throws:
TestParseException
- if a parsing error was encountered
-
parseTolerance
- Throws:
TestParseException
-
getInstance
Gets an instance of a class with the given name, and ensures that the class is assignable to a specified baseClass.- Returns:
- an instance of the class, if it is assignment-compatible, or null if the requested class is not assigment-compatible
-
wktFile
- Throws:
TestParseException
-
readGeometry
private Geometry readGeometry(org.jdom2.Element geometryElement, File wktFile) throws FileNotFoundException, ParseException, IOException -
toString
-
absoluteWktFile
-
getContents
Returns a List of the String's in the text file, one per line.- Throws:
FileNotFoundException
IOException
-