public abstract class DataTestCase extends Object
By isolating a common set of SimpleFeature
s, SimpleFeatureType
s and Filter
s we are able to reduce the amount of overhead in setting up new tests.
This code has been made part of the public geotools.jar
to provide a starting point
for test cases involving Data constructs.
Constructor and Description |
---|
DataTestCase() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertGeometryEquals(Geometry expected,
Geometry actual)
Compares two geometries for equality.
|
protected void |
assertGeometryEquals(String message,
Geometry expected,
Geometry actual)
Compares two geometries for equality.
|
protected int |
count(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
Counts the number of Features returned by the specified reader.
|
protected int |
count(FeatureWriter<SimpleFeatureType,SimpleFeature> writer)
Counts the number of Features in the specified writer.
|
protected void |
dataSetUp()
Loads the data.
|
protected int |
expected(Filter filter) |
void |
init()
Invoked before a test is run.
|
LineString |
line(int[] xy)
Creates a line from the specified (x,y) coordinates.
|
MultiLineString |
lines(int[][] xy)
Creates a multiline from the specified (x,y) coordinates.
|
Polygon |
polygon(int[] xy)
Creates a polygon from the specified (x,y) coordinates.
|
Polygon |
polygon(int[] xy,
int[][] holes)
Creates a line from the specified (x,y) coordinates and an arbitrary
amount of holes.
|
LinearRing |
ring(int[] xy)
Creates a ring from the specified (x,y) coordinates.
|
void |
tearDown()
Set all data references to
null , allowing garbage collection. |
protected GeometryFactory gf
protected SimpleFeatureType roadType
protected SimpleFeatureType subRoadType
protected SimpleFeature[] roadFeatures
protected ReferencedEnvelope roadBounds
protected ReferencedEnvelope rd12Bounds
protected Filter rd1Filter
protected Filter rd2Filter
protected Filter rd12Filter
protected SimpleFeature newRoad
protected SimpleFeatureType riverType
protected SimpleFeatureType subRiverType
protected SimpleFeature[] riverFeatures
protected ReferencedEnvelope riverBounds
protected Filter rv1Filter
protected SimpleFeature newRiver
protected SimpleFeatureType lakeType
protected SimpleFeature[] lakeFeatures
protected ReferencedEnvelope lakeBounds
protected SimpleFeatureType invalidGeomType
protected SimpleFeature[] invalidGeomFeatures
protected ReferencedEnvelope invalidGeomBounds
protected SimpleFeatureType buildingType
protected SimpleFeature[] buildingFeatures
protected ReferencedEnvelope buildingBounds
protected FilterFactory2 ff
protected int expected(Filter filter)
public void init() throws Exception
dataSetUp()
.Exception
protected void dataSetUp() throws Exception
public void tearDown() throws Exception
null
, allowing garbage collection. This method is
automatically invoked after each test.Exception
public LineString line(int[] xy)
public MultiLineString lines(int[][] xy)
public Polygon polygon(int[] xy)
public Polygon polygon(int[] xy, int[][] holes)
public LinearRing ring(int[] xy)
protected void assertGeometryEquals(Geometry expected, Geometry actual)
protected void assertGeometryEquals(String message, Geometry expected, Geometry actual)
protected int count(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
This method will close the reader.
IOException
protected int count(FeatureWriter<SimpleFeatureType,SimpleFeature> writer) throws NoSuchElementException, IOException
NoSuchElementException
IOException
Copyright © 1996–2023 Geotools. All rights reserved.