Skip to content

Commit 2124979

Browse files
author
Josh Devins
committed
fixed tests
1 parent fcbbff2 commit 2124979

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/test/java/net/joshdevins/gis/geocoder/ShapefileIndexerTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void testBasicIndexing() throws Exception {
4848
System.out.printf("Index built in: %.2f seconds\n", (new Date().getTime() - start) / (float) 1000);
4949

5050
GeometryFactory geometryFactory = new GeometryFactory();
51+
new File("target/test/output/flickr-shapes").mkdirs();
5152
File output = new File("target/test/output/flickr-shapes/neighbourhoods.txt");
5253
Formatter formatter = new Formatter(output);
5354

@@ -81,7 +82,7 @@ public void testBasicIndexing() throws Exception {
8182
@Test
8283
public void testPrintShapefile() throws Exception {
8384

84-
File shapefile = new File("data/build/flickr-shapes/continents.shp");
85+
File shapefile = new File("data/build/flickr-shapes/counties.shp");
8586
ShapefileDataStore store = new ShapefileDataStore(shapefile.toURI().toURL());
8687

8788
String name = store.getTypeNames()[0];
@@ -103,7 +104,8 @@ public void testPrintShapefile() throws Exception {
103104
// now print out the feature contents (every non geometric attribute)
104105
SimpleFeatureIterator features = source.getFeatures().features();
105106

106-
while (features.hasNext()) {
107+
int i = 0;
108+
while (features.hasNext() && i < 10) {
107109
SimpleFeature feature = features.next();
108110

109111
System.out.print(feature.getID() + "\t");
@@ -116,16 +118,21 @@ public void testPrintShapefile() throws Exception {
116118
}
117119

118120
System.out.println();
121+
i++;
119122
}
120123

121124
// and finally print out every geometry in wkt format
122125
features = source.getFeatures().features();
123-
while (features.hasNext()) {
126+
i = 0;
127+
while (features.hasNext() && i < 10) {
124128

125129
SimpleFeature feature = features.next();
126130

127131
System.out.print(feature.getID() + "\t");
128132
System.out.println(feature.getDefaultGeometry());
133+
i++;
129134
}
135+
136+
store.dispose();
130137
}
131138
}

0 commit comments

Comments
 (0)