org.geotools.data
Class DataTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.geotools.data.DataTestCase
All Implemented Interfaces:
junit.framework.Test

public class DataTestCase
extends junit.framework.TestCase

A set of constructs and utility methods used to test the data module.

By isolating a commong set of Features,FeatureTypes and Filters we are able to reduce the amount of overhead in setting up new tests.

We have also special cased assert( Geometry, Geometry ) to work around Geometry.equals( Object ) not working as expected.

This code has been made part of the public geotools.jar to provide a starting point for test cases involcing Data constructs.

Author:
Jody Garnett, Refractions Research

Field Summary
protected  com.vividsolutions.jts.geom.GeometryFactory gf
           
protected  com.vividsolutions.jts.geom.Envelope lakeBounds
           
protected  Feature[] lakeFeatures
           
protected  FeatureType lakeType
           
protected  Feature newRiver
           
protected  Feature newRoad
           
protected  com.vividsolutions.jts.geom.Envelope rd12Bounds
           
protected  Filter rd12Filter
           
protected  Filter rd1Filter
           
protected  Filter rd2Filter
           
protected  com.vividsolutions.jts.geom.Envelope riverBounds
           
protected  Feature[] riverFeatures
           
protected  FeatureType riverType
           
protected  com.vividsolutions.jts.geom.Envelope roadBounds
           
protected  Feature[] roadFeatures
           
protected  FeatureType roadType
           
protected  Filter rv1Filter
           
protected  FeatureType subRiverType
           
protected  FeatureType subRoadType
           
 
Constructor Summary
DataTestCase(java.lang.String arg0)
          Constructor for DataUtilitiesTest.
 
Method Summary
protected  void assertEquals(com.vividsolutions.jts.geom.Geometry expected, com.vividsolutions.jts.geom.Geometry actual)
           
protected  void assertEquals(java.lang.String message, com.vividsolutions.jts.geom.Geometry expected, com.vividsolutions.jts.geom.Geometry actual)
           
protected  int count(FeatureReader reader)
          Counts the number of Features returned by reader.
protected  int count(FeatureWriter writer)
           
 com.vividsolutions.jts.geom.LineString line(int[] xy)
           
 com.vividsolutions.jts.geom.MultiLineString lines(int[][] xy)
           
 com.vividsolutions.jts.geom.Polygon polygon(int[] xy)
           
 com.vividsolutions.jts.geom.Polygon polygon(int[] xy, int[][] holes)
           
 com.vividsolutions.jts.geom.LinearRing ring(int[] xy)
           
protected  void setUp()
           
protected  void tearDown()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gf

protected com.vividsolutions.jts.geom.GeometryFactory gf

roadType

protected FeatureType roadType

subRoadType

protected FeatureType subRoadType

roadFeatures

protected Feature[] roadFeatures

roadBounds

protected com.vividsolutions.jts.geom.Envelope roadBounds

rd12Bounds

protected com.vividsolutions.jts.geom.Envelope rd12Bounds

rd1Filter

protected Filter rd1Filter

rd2Filter

protected Filter rd2Filter

rd12Filter

protected Filter rd12Filter

newRoad

protected Feature newRoad

riverType

protected FeatureType riverType

subRiverType

protected FeatureType subRiverType

riverFeatures

protected Feature[] riverFeatures

riverBounds

protected com.vividsolutions.jts.geom.Envelope riverBounds

rv1Filter

protected Filter rv1Filter

newRiver

protected Feature newRiver

lakeType

protected FeatureType lakeType

lakeFeatures

protected Feature[] lakeFeatures

lakeBounds

protected com.vividsolutions.jts.geom.Envelope lakeBounds
Constructor Detail

DataTestCase

public DataTestCase(java.lang.String arg0)
Constructor for DataUtilitiesTest.

Parameters:
arg0 -
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Throws:
java.lang.Exception

line

public com.vividsolutions.jts.geom.LineString line(int[] xy)

lines

public com.vividsolutions.jts.geom.MultiLineString lines(int[][] xy)

polygon

public com.vividsolutions.jts.geom.Polygon polygon(int[] xy)

polygon

public com.vividsolutions.jts.geom.Polygon polygon(int[] xy,
                                                   int[][] holes)

ring

public com.vividsolutions.jts.geom.LinearRing ring(int[] xy)

assertEquals

protected void assertEquals(com.vividsolutions.jts.geom.Geometry expected,
                            com.vividsolutions.jts.geom.Geometry actual)

assertEquals

protected void assertEquals(java.lang.String message,
                            com.vividsolutions.jts.geom.Geometry expected,
                            com.vividsolutions.jts.geom.Geometry actual)

count

protected int count(FeatureReader reader)
             throws java.io.IOException
Counts the number of Features returned by reader.

This method will close reader

Throws:
java.io.IOException

count

protected int count(FeatureWriter writer)
             throws java.util.NoSuchElementException,
                    java.io.IOException,
                    IllegalAttributeException
Throws:
java.util.NoSuchElementException
java.io.IOException
IllegalAttributeException


Copyright © 1996-2003 GeoTools. All Rights Reserved.