public class DataTestCase
extends TestCase
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(String name)
Creates a default test case with the given name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertEquals(Geometry expected,
Geometry actual)
Compares two geometries for equality.
|
protected void |
assertEquals(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) |
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.
|
protected void |
setUp()
Invoked before a test is run.
|
protected void |
tearDown()
Set all data references to
null , allowing garbage collection. |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
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
public DataTestCase(String name)
protected int expected(Filter filter)
protected void setUp() throws Exception
dataSetUp()
.setUp
in class TestCase
Exception
protected void dataSetUp() throws Exception
protected void tearDown() throws Exception
null
, allowing garbage collection. This method is
automatically invoked after each test.tearDown
in class TestCase
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 assertEquals(Geometry expected, Geometry actual)
protected void assertEquals(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–2019 Geotools. All rights reserved.