Improve null handling in tests

Change-Id: Ia01359e4b273b1fc9f9835d5d9c10057af051f2e
diff --git a/src/test/java/org/ids_mannheim/WorkerTest.java b/src/test/java/org/ids_mannheim/WorkerTest.java
index 5eab373..c4d8758 100644
--- a/src/test/java/org/ids_mannheim/WorkerTest.java
+++ b/src/test/java/org/ids_mannheim/WorkerTest.java
@@ -8,6 +8,7 @@
 import java.io.*;
 import java.util.ArrayList;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -49,8 +50,8 @@
         File tempFile = File.createTempFile("goe_sample", ".conllu.gz");
         tempFile.deleteOnExit();
         try (FileOutputStream out = new FileOutputStream(tempFile)) {
-            IOUtils.copy(Thread.currentThread().getContextClassLoader()
-                    .getResourceAsStream("goe_sample.conllu.gz"), out);
+            IOUtils.copy(Objects.requireNonNull(Thread.currentThread().getContextClassLoader()
+                    .getResourceAsStream("goe_sample.conllu.gz")), out);
         }
         ArrayList<String> fnames = new ArrayList<>();
         fnames.add(tempFile.getAbsolutePath());
@@ -75,9 +76,7 @@
         gold.forEach((key, value) -> {
             AtomicInteger observed = map.get(key);
             assertNotNull(observed);
-            if (observed != null) {
-                assertEquals(value, observed.intValue());
-            }
+            assertEquals(value, observed.intValue());
         });
         assertTrue(errContent.toString().contains("with 1 text"));
         assertTrue(errContent.toString().contains("100%"));
@@ -101,8 +100,8 @@
         File tempFile = File.createTempFile("goe_sample", ".conllu.gz");
         tempFile.deleteOnExit();
         try (FileOutputStream out = new FileOutputStream(tempFile)) {
-            IOUtils.copy(Thread.currentThread().getContextClassLoader()
-                    .getResourceAsStream("goe_sample.conllu.gz"), out);
+            IOUtils.copy(Objects.requireNonNull(Thread.currentThread().getContextClassLoader()
+                    .getResourceAsStream("goe_sample.conllu.gz")), out);
         }
         ArrayList<String> fnames = new ArrayList<>();
         fnames.add(tempFile.getAbsolutePath());
@@ -128,9 +127,7 @@
 //            System.out.println("KEY: " + key);
             AtomicInteger observed = map.get(key);
             assertNotNull(observed);
-            if (observed != null) {
-                assertEquals(value, observed.intValue());
-            }
+            assertEquals(value, observed.intValue());
         });
         assertTrue(errContent.toString().contains("100%"));
     }
@@ -148,8 +145,8 @@
         File tempFile = File.createTempFile("entities", ".conllu");
         tempFile.deleteOnExit();
         try (FileOutputStream out = new FileOutputStream(tempFile)) {
-            IOUtils.copy(Thread.currentThread().getContextClassLoader()
-                    .getResourceAsStream("entities.conllu"), out);
+            IOUtils.copy(Objects.requireNonNull(Thread.currentThread().getContextClassLoader()
+                    .getResourceAsStream("entities.conllu")), out);
         }
         ArrayList<String> fnames = new ArrayList<>();
         fnames.add(tempFile.getAbsolutePath());
@@ -193,8 +190,8 @@
         File tempFile = File.createTempFile("goe_sample", ".conllu.xz");
         tempFile.deleteOnExit();
         try (FileOutputStream out = new FileOutputStream(tempFile)) {
-            IOUtils.copy(Thread.currentThread().getContextClassLoader()
-                    .getResourceAsStream("goe_sample.conllu.xz"), out);
+            IOUtils.copy(Objects.requireNonNull(Thread.currentThread().getContextClassLoader()
+                    .getResourceAsStream("goe_sample.conllu.xz")), out);
         }
         ArrayList<String> fnames = new ArrayList<>();
         fnames.add(tempFile.getAbsolutePath());