ImportTrackAction extends ExecCommand { private static FeatureCollection<SimpleFeatureType, SimpleFeature> readTrack(File file, GeoCoding geoCoding) throws IOException { Reader reader = new FileReader(file); try { return readTrack(reader, geoCoding); } finally { reader.close(); } }  @Override void actionPerformed(final CommandEvent event); @Override void updateState(final CommandEvent event); static final String TITLE; }
@Test public void testReadTrack() throws Exception { CrsGeoCoding geoCoding = new CrsGeoCoding(DefaultGeographicCRS.WGS84, new Rectangle(360, 180), new AffineTransform()); InputStreamReader reader = new InputStreamReader(getClass().getResourceAsStream("TrackData.csv")); FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = ImportTrackAction.readTrack(reader, geoCoding); assertNotNull(featureCollection); assertEquals(23, featureCollection.size()); SimpleFeature[] simpleFeatures = featureCollection.toArray(new SimpleFeature[0]); assertEquals(23, simpleFeatures.length); assertEquals("ID00000000", simpleFeatures[0].getID()); assertEquals("ID00000011", simpleFeatures[11].getID()); assertEquals("ID00000022", simpleFeatures[22].getID()); }