Changeset 10641 in josm for trunk/test/unit/org
- Timestamp:
- 2016-07-25T21:41:53+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java
r10638 r10641 4 4 import static org.junit.Assert.assertEquals; 5 5 6 import java.io.BufferedReader;7 import java.io.IOException;8 import java.net.URL;9 6 import java.util.Arrays; 10 7 import java.util.Collections; … … 14 11 import org.junit.Assert; 15 12 import org.junit.Test; 16 import org.openstreetmap.josm.Main;17 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 14 … … 87 83 Assert.assertEquals("127f", Utils.toHexString(new byte[]{0x12, 0x7f})); 88 84 Assert.assertEquals("fedc", Utils.toHexString(new byte[]{(byte) 0xfe, (byte) 0xdc})); 89 }90 91 /**92 * Test of {@link Utils#openURLReaderAndDecompress} method with Gzip compression.93 * @throws IOException if any I/O error occurs94 */95 @Test96 public void testOpenUrlGzip() throws IOException {97 Main.initApplicationPreferences();98 final URL url = new URL("https://www.openstreetmap.org/trace/1613906/data");99 try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) {100 Assert.assertTrue(x.readLine().startsWith("<?xml version="));101 }102 }103 104 /**105 * Test of {@link Utils#openURLReaderAndDecompress} method with Bzip compression.106 * @throws IOException if any I/O error occurs107 */108 @Test109 public void testOpenUrlBzip() throws IOException {110 Main.initApplicationPreferences();111 final URL url = new URL("https://www.openstreetmap.org/trace/785544/data");112 try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) {113 Assert.assertTrue(x.readLine().startsWith("<?xml version="));114 }115 }116 117 /**118 * Test of {@link Utils#openURLReaderAndDecompress} method with Bzip compression.119 * @throws IOException if any I/O error occurs120 */121 @Test122 public void testTicket9660() throws IOException {123 Main.initApplicationPreferences();124 final URL url = new URL("http://www.openstreetmap.org/trace/1350010/data");125 try (BufferedReader x = HttpClient.create(url).connect()126 .uncompress(true).uncompressAccordingToContentDisposition(true).getContentReader()) {127 Assert.assertTrue(x.readLine().startsWith("<?xml version="));128 }129 85 } 130 86
Note:
See TracChangeset
for help on using the changeset viewer.