[tor-commits] [collector/release] Tweak DownloaderTest a bit.

karsten at torproject.org karsten at torproject.org
Wed Jan 15 22:25:08 UTC 2020


commit 5d5d2eba7fb1c1fda3a0a16fe1cb5daf84f8ec47
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Nov 20 12:00:15 2019 +0100

    Tweak DownloaderTest a bit.
---
 .../metrics/collector/downloader/DownloaderTest.java      | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/test/java/org/torproject/metrics/collector/downloader/DownloaderTest.java b/src/test/java/org/torproject/metrics/collector/downloader/DownloaderTest.java
index 0617940..aef8c0c 100644
--- a/src/test/java/org/torproject/metrics/collector/downloader/DownloaderTest.java
+++ b/src/test/java/org/torproject/metrics/collector/downloader/DownloaderTest.java
@@ -15,7 +15,6 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.SocketTimeoutException;
 import java.net.URL;
@@ -42,21 +41,19 @@ public class DownloaderTest {
    */
   private static class HttpUrlStreamHandler extends URLStreamHandler {
 
-    private Map<URL, URLConnection> connections = new HashMap();
+    private Map<URL, URLConnection> connections = new HashMap<>();
 
     @Override
-    protected URLConnection openConnection(URL url) throws IOException {
-      return connections.get(url);
+    protected URLConnection openConnection(URL url) {
+      return this.connections.get(url);
     }
 
     private void resetConnections() {
-      connections = new HashMap();
+      this.connections = new HashMap<>();
     }
 
-    private HttpUrlStreamHandler addConnection(URL url,
-        URLConnection urlConnection) {
-      connections.put(url, urlConnection);
-      return this;
+    private void addConnection(URL url, URLConnection urlConnection) {
+      this.connections.put(url, urlConnection);
     }
   }
 





More information about the tor-commits mailing list