Ignore:
Timestamp:
2015-12-03T22:27:47+01:00 (9 years ago)
Author:
floscher
Message:

[mapillary] Add tests for TrafficoSign

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java

    r31787 r31795  
    3737        "Bearer " + Main.pref.get("mapillary.access-token"));
    3838
    39     BufferedReader in = new BufferedReader(new InputStreamReader(
    40         con.getInputStream()));
    41     return Json.createReader(in).readObject();
     39    try (
     40      BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))
     41    ) {
     42      return Json.createReader(in).readObject();
     43    }
    4244  }
    4345}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/traffico/TrafficoGlyph.java

    r31793 r31795  
    1010import javax.json.JsonReader;
    1111
    12 public class TrafficoGlyph {
     12public final class TrafficoGlyph {
    1313  private TrafficoGlyph() {
    1414    // private constructor to avoid instantiation
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/traffico/TrafficoSign.java

    r31787 r31795  
    99import java.util.Map;
    1010import java.util.Set;
    11 import java.util.TreeMap;
    1211
    1312import javax.json.Json;
     
    1514import javax.json.JsonObject;
    1615
    17 public class TrafficoSign {
    18   private static final Map<String, String> isIn = new TreeMap<>();
    19 
    20   static {
    21     isIn.put("be", "europe");
    22     isIn.put("de", "europe");
    23     isIn.put("dk", "europe");
    24     isIn.put("es", "europe");
     16public final class TrafficoSign {
     17  private TrafficoSign() {
     18    // private constructor to avoid instantiation
    2519  }
    2620
     
    3125      System.out.println("Read signs for " + country);
    3226      InputStream countryStream = TrafficoSign.class
    33           .getResourceAsStream("/data/fonts/traffico/signs/" + country
    34               + ".json");
     27          .getResourceAsStream("/data/fonts/traffico/signs/" + country + ".json");
    3528      if (countryStream == null) {
    3629        return null;
     
    8982      return signs.get(country).get(signName);
    9083    }
    91     if (isIn.containsKey(country)) {
    92       return TrafficoSign.getSign(isIn.get(country), signName);
    93     }
    9484    return null;
    9585  }
Note: See TracChangeset for help on using the changeset viewer.