Changeset 9174 in josm for trunk/test


Ignore:
Timestamp:
2015-12-27T00:07:00+01:00 (5 years ago)
Author:
simon04
Message:

see #12231 - Update unit tests, fix regression

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java

    r8857 r9174  
    8686    public void testOpenUrlGzip() throws IOException {
    8787        Main.initApplicationPreferences();
    88         try (BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/1613906/data"), true)) {
     88        final URL url = new URL("https://www.openstreetmap.org/trace/1613906/data");
     89        try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) {
    8990            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
    9091        }
     
    9899    public void testOpenUrlBzip() throws IOException {
    99100        Main.initApplicationPreferences();
    100         try (BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/785544/data"), true)) {
     101        final URL url = new URL("https://www.openstreetmap.org/trace/785544/data");
     102        try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) {
     103            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
     104        }
     105    }
     106
     107    /**
     108     * Test of {@link Utils#openURLReaderAndDecompress} method with Bzip compression.
     109     * @throws IOException if any I/O error occurs
     110     */
     111    @Test
     112    public void testTicket9660() throws IOException {
     113        Main.initApplicationPreferences();
     114        final URL url = new URL("http://www.openstreetmap.org/trace/1350010/data");
     115        try (BufferedReader x = HttpClient.create(url).connect()
     116                .uncompress(true).uncompressAccordingToContentDisposition(true).getContentReader()) {
    101117            Assert.assertTrue(x.readLine().startsWith("<?xml version="));
    102118        }
Note: See TracChangeset for help on using the changeset viewer.