Changeset 15034 in josm for trunk/test/unit/org/openstreetmap/josm/data
- Timestamp:
- 2019-05-02T04:33:57+02:00 (5 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r13079 r15034 6 6 import static org.junit.Assert.assertTrue; 7 7 8 import java.io.FileInputStream;9 8 import java.io.InputStream; 9 import java.nio.file.Files; 10 import java.nio.file.Paths; 10 11 import java.util.Arrays; 11 12 import java.util.Collection; … … 73 74 for (int i : new int[] {1, 2, 3, 11, 12, 13, 14, 15}) { 74 75 DataSet ds; 75 try (InputStream is = new FileInputStream("data_nodist/filterTests.osm")) {76 try (InputStream is = Files.newInputStream(Paths.get("data_nodist/filterTests.osm"))) { 76 77 ds = OsmReader.parseDataSet(is, NullProgressMonitor.INSTANCE); 77 78 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r14120 r15034 4 4 import static org.openstreetmap.josm.TestUtils.getPrivateField; 5 5 6 import java.io.FileInputStream;7 6 import java.io.InputStream; 7 import java.nio.file.Files; 8 import java.nio.file.Paths; 8 9 import java.security.SecureRandom; 9 10 import java.util.ArrayList; … … 84 85 public void testRemove() throws Exception { 85 86 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 86 try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) {87 try (InputStream fis = Files.newInputStream(Paths.get("data_nodist/restriction.osm"))) { 87 88 DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); 88 89 removeAllTest(ds); … … 97 98 public void testMove() throws Exception { 98 99 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 99 try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) {100 try (InputStream fis = Files.newInputStream(Paths.get("data_nodist/restriction.osm"))) { 100 101 DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); 101 102 -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r14273 r15034 5 5 import java.io.BufferedWriter; 6 6 import java.io.File; 7 import java.io.FileInputStream;8 import java.io.FileOutputStream;9 7 import java.io.IOException; 10 8 import java.io.InputStream; … … 15 13 import java.lang.reflect.Method; 16 14 import java.nio.charset.StandardCharsets; 15 import java.nio.file.Files; 16 import java.nio.file.Paths; 17 17 import java.security.SecureRandom; 18 18 import java.util.ArrayList; … … 121 121 } 122 122 try (BufferedReader in = new BufferedReader(new InputStreamReader( 123 new FileInputStream(REFERENCE_DATA_FILE), StandardCharsets.UTF_8))) {123 Files.newInputStream(Paths.get(REFERENCE_DATA_FILE)), StandardCharsets.UTF_8))) { 124 124 String line; 125 125 Pattern projPattern = Pattern.compile("<(.+?)>(.*)<>"); … … 357 357 } 358 358 try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter( 359 new FileOutputStream(REFERENCE_DATA_FILE), StandardCharsets.UTF_8))) {359 Files.newOutputStream(Paths.get(REFERENCE_DATA_FILE)), StandardCharsets.UTF_8))) { 360 360 for (Map.Entry<String, RefEntry> e : refsMap.entrySet()) { 361 361 RefEntry ref = e.getValue(); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r13702 r15034 5 5 import java.io.BufferedWriter; 6 6 import java.io.File; 7 import java.io.FileInputStream;8 7 import java.io.FileNotFoundException; 9 import java.io.FileOutputStream;10 8 import java.io.IOException; 11 9 import java.io.InputStreamReader; 12 10 import java.io.OutputStreamWriter; 13 11 import java.nio.charset.StandardCharsets; 12 import java.nio.file.Files; 13 import java.nio.file.Paths; 14 14 import java.security.SecureRandom; 15 15 import java.util.ArrayList; … … 89 89 Random rand = new SecureRandom(); 90 90 try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter( 91 new FileOutputStream(PROJECTION_DATA_FILE), StandardCharsets.UTF_8))) {91 Files.newOutputStream(Paths.get(PROJECTION_DATA_FILE)), StandardCharsets.UTF_8))) { 92 92 out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n"); 93 93 out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n"); … … 114 114 115 115 private static List<TestData> readData() throws IOException, FileNotFoundException { 116 try (BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(PROJECTION_DATA_FILE),116 try (BufferedReader in = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get(PROJECTION_DATA_FILE)), 117 117 StandardCharsets.UTF_8))) { 118 118 List<TestData> result = new ArrayList<>(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
r8926 r15034 5 5 import static org.junit.Assert.assertThat; 6 6 7 import java.io.FileInputStream;8 7 import java.io.FileNotFoundException; 9 8 import java.io.IOException; 10 9 import java.io.InputStream; 10 import java.nio.file.Files; 11 import java.nio.file.Paths; 11 12 12 13 import org.junit.Before; … … 45 46 @Test 46 47 public void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException { 47 try (InputStream fis = new FileInputStream("data_nodist/UnconnectedWaysTest.osm")) {48 try (InputStream fis = Files.newInputStream(Paths.get("data_nodist/UnconnectedWaysTest.osm"))) { 48 49 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); 49 50 bib.visit(ds.allPrimitives()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ValidatorTestUtils.java
r14966 r15034 6 6 import static org.junit.Assert.fail; 7 7 8 import java.io.FileInputStream;9 8 import java.io.InputStream; 9 import java.nio.file.Files; 10 import java.nio.file.Paths; 10 11 import java.util.ArrayList; 11 12 import java.util.Collections; … … 35 36 Function<DataSet, Iterable<T>> provider, Predicate<String> namePredicate, 36 37 Test... tests) throws Exception { 37 try (InputStream is = new FileInputStream(sampleFile)) {38 try (InputStream is = Files.newInputStream(Paths.get(sampleFile))) { 38 39 for (T t: provider.apply(OsmReader.parseDataSet(is, null))) { 39 40 String name = DefaultNameFormatter.getInstance().format(t);
Note:
See TracChangeset
for help on using the changeset viewer.