Ignore:
Timestamp:
2019-05-02T04:33:57+02:00 (5 years ago)
Author:
Don-vip
Message:

checkstyle/PMD

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  
    66import static org.junit.Assert.assertTrue;
    77
    8 import java.io.FileInputStream;
    98import java.io.InputStream;
     9import java.nio.file.Files;
     10import java.nio.file.Paths;
    1011import java.util.Arrays;
    1112import java.util.Collection;
     
    7374        for (int i : new int[] {1, 2, 3, 11, 12, 13, 14, 15}) {
    7475            DataSet ds;
    75             try (InputStream is = new FileInputStream("data_nodist/filterTests.osm")) {
     76            try (InputStream is = Files.newInputStream(Paths.get("data_nodist/filterTests.osm"))) {
    7677                ds = OsmReader.parseDataSet(is, NullProgressMonitor.INSTANCE);
    7778            }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java

    r14120 r15034  
    44import static org.openstreetmap.josm.TestUtils.getPrivateField;
    55
    6 import java.io.FileInputStream;
    76import java.io.InputStream;
     7import java.nio.file.Files;
     8import java.nio.file.Paths;
    89import java.security.SecureRandom;
    910import java.util.ArrayList;
     
    8485    public void testRemove() throws Exception {
    8586        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"))) {
    8788            DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
    8889            removeAllTest(ds);
     
    9798    public void testMove() throws Exception {
    9899        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"))) {
    100101            DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
    101102
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r14273 r15034  
    55import java.io.BufferedWriter;
    66import java.io.File;
    7 import java.io.FileInputStream;
    8 import java.io.FileOutputStream;
    97import java.io.IOException;
    108import java.io.InputStream;
     
    1513import java.lang.reflect.Method;
    1614import java.nio.charset.StandardCharsets;
     15import java.nio.file.Files;
     16import java.nio.file.Paths;
    1717import java.security.SecureRandom;
    1818import java.util.ArrayList;
     
    121121        }
    122122        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))) {
    124124            String line;
    125125            Pattern projPattern = Pattern.compile("<(.+?)>(.*)<>");
     
    357357        }
    358358        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))) {
    360360            for (Map.Entry<String, RefEntry> e : refsMap.entrySet()) {
    361361                RefEntry ref = e.getValue();
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r13702 r15034  
    55import java.io.BufferedWriter;
    66import java.io.File;
    7 import java.io.FileInputStream;
    87import java.io.FileNotFoundException;
    9 import java.io.FileOutputStream;
    108import java.io.IOException;
    119import java.io.InputStreamReader;
    1210import java.io.OutputStreamWriter;
    1311import java.nio.charset.StandardCharsets;
     12import java.nio.file.Files;
     13import java.nio.file.Paths;
    1414import java.security.SecureRandom;
    1515import java.util.ArrayList;
     
    8989        Random rand = new SecureRandom();
    9090        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))) {
    9292            out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n");
    9393            out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n");
     
    114114
    115115    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)),
    117117                StandardCharsets.UTF_8))) {
    118118            List<TestData> result = new ArrayList<>();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java

    r8926 r15034  
    55import static org.junit.Assert.assertThat;
    66
    7 import java.io.FileInputStream;
    87import java.io.FileNotFoundException;
    98import java.io.IOException;
    109import java.io.InputStream;
     10import java.nio.file.Files;
     11import java.nio.file.Paths;
    1112
    1213import org.junit.Before;
     
    4546    @Test
    4647    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"))) {
    4849            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
    4950            bib.visit(ds.allPrimitives());
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ValidatorTestUtils.java

    r14966 r15034  
    66import static org.junit.Assert.fail;
    77
    8 import java.io.FileInputStream;
    98import java.io.InputStream;
     9import java.nio.file.Files;
     10import java.nio.file.Paths;
    1011import java.util.ArrayList;
    1112import java.util.Collections;
     
    3536            Function<DataSet, Iterable<T>> provider, Predicate<String> namePredicate,
    3637            Test... tests) throws Exception {
    37         try (InputStream is = new FileInputStream(sampleFile)) {
     38        try (InputStream is = Files.newInputStream(Paths.get(sampleFile))) {
    3839            for (T t: provider.apply(OsmReader.parseDataSet(is, null))) {
    3940                String name = DefaultNameFormatter.getInstance().format(t);
Note: See TracChangeset for help on using the changeset viewer.