Changeset 8606 in josm for trunk/test/unit
- Timestamp:
- 2015-07-16T21:13:12+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java
r8604 r8606 15 15 public class JCSCachedTileLoaderJobTest { 16 16 private static class TestCachedTileLoaderJob extends JCSCachedTileLoaderJob<String, CacheEntry> { 17 private String url; 17 18 18 private int responseCode; 19 20 public TestCachedTileLoaderJob(int responseCode) throws IOException { 19 public TestCachedTileLoaderJob(String url) throws IOException { 21 20 super(getCache(), 30000, 30000, null); 22 this. responseCode = responseCode;21 this.url = url; 23 22 } 24 23 … … 35 34 public URL getUrl() { 36 35 try { 37 return new URL( "http://httpstat.us/" + Integer.toString(responseCode));36 return new URL(url); 38 37 } catch (MalformedURLException e) { 39 38 throw new RuntimeException(e); … … 86 85 } 87 86 87 @Test 88 public void testUnkownHost() throws Exception { 89 TestCachedTileLoaderJob job = new TestCachedTileLoaderJob("http://unkownhost.unkownhost/unkown"); 90 Listener listener = new Listener(); 91 job.submit(listener, true); 92 synchronized (listener) { 93 if (!listener.ready) { 94 listener.wait(); 95 } 96 } 97 assertEquals("java.net.UnknownHostException: unkownhost.unkownhost", listener.attributes.getErrorMessage()); 98 } 99 88 100 public void testStatusCode(int responseCode) throws Exception { 89 TestCachedTileLoaderJob job = new TestCachedTileLoaderJob(responseCode);101 TestCachedTileLoaderJob job = getStatusLoaderJob(responseCode); 90 102 Listener listener = new Listener(); 91 103 job.submit(listener, true); … … 98 110 99 111 } 112 113 private static TestCachedTileLoaderJob getStatusLoaderJob(int responseCode) throws IOException { 114 return new TestCachedTileLoaderJob("http://httpstat.us/" + responseCode); 115 } 116 100 117 } 101 118
Note:
See TracChangeset
for help on using the changeset viewer.