Changeset 30558 in osm for applications/editors/josm/plugins/ElevationProfile/test/unit
- Timestamp:
- 2014-08-04T21:31:18+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/test/unit/org/openstreetmap/josm/plugins/elevation/tests/HgtReaderTest.java
r30344 r30558 2 2 package org.openstreetmap.josm.plugins.elevation.tests; 3 3 4 import java.io.IOException; 5 import java.nio.file.DirectoryIteratorException; 6 import java.nio.file.DirectoryStream; 7 import java.nio.file.Files; 8 import java.nio.file.Path; 9 import java.nio.file.Paths; 10 4 11 import junit.framework.TestCase; 5 12 6 import org.openstreetmap.josm. Main;7 import org.openstreetmap.josm. data.Preferences;13 import org.openstreetmap.josm.JOSMFixture; 14 import org.openstreetmap.josm.TestUtils; 8 15 import org.openstreetmap.josm.data.coor.LatLon; 9 16 import org.openstreetmap.josm.plugins.elevation.HgtReader; … … 13 20 /** 14 21 * Setup test. 22 * @throws IOException if SRTM files cannot be installed 15 23 */ 16 24 @Override 17 public void setUp() { 18 Main.pref = new Preferences(); 25 public void setUp() throws IOException { 26 JOSMFixture.createUnitTestFixture().init(); 27 // Install SRTM files to plugin directory 28 try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(TestUtils.getTestDataRoot()), "*.hgt")) { 29 Path dir = Paths.get(System.getProperty("josm.home")).resolve("elevation"); 30 if (!Files.exists(dir)) { 31 Files.createDirectory(dir); 32 } 33 for (Path src: stream) { 34 Path dst = dir.resolve(src.getFileName()); 35 if (!Files.exists(dst)) { 36 Files.copy(src, dst); 37 } 38 } 39 } catch (DirectoryIteratorException ex) { 40 // I/O error encounted during the iteration, the cause is an IOException 41 throw ex.getCause(); 42 } 19 43 } 20 44
Note:
See TracChangeset
for help on using the changeset viewer.