Replace unnecessary type parameters with <>
[Sone.git] / src / test / java / net / pterodactylus / sone / core / SoneInserterTest.java
index 51947d1..94eabb0 100644 (file)
@@ -1,6 +1,5 @@
 package net.pterodactylus.sone.core;
 
-import static com.google.common.base.Optional.of;
 import static com.google.common.io.ByteStreams.toByteArray;
 import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
 import static java.lang.System.currentTimeMillis;
@@ -49,8 +48,6 @@ import org.mockito.stubbing.Answer;
 
 /**
  * Unit test for {@link SoneInserter} and its subclasses.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 public class SoneInserterTest {
 
@@ -62,7 +59,7 @@ public class SoneInserterTest {
        public void setupCore() {
                UpdateChecker updateChecker = mock(UpdateChecker.class);
                when(core.getUpdateChecker()).thenReturn(updateChecker);
-               when(core.getSone(anyString())).thenReturn(Optional.<Sone>absent());
+               when(core.getSone(anyString())).thenReturn(null);
        }
 
        @Test
@@ -78,7 +75,7 @@ public class SoneInserterTest {
                when(sone.getInsertUri()).thenReturn(insertUri);
                when(sone.getFingerprint()).thenReturn(fingerprint);
                when(sone.getRootAlbum()).thenReturn(mock(Album.class));
-               when(core.getSone(anyString())).thenReturn(of(sone));
+               when(core.getSone(anyString())).thenReturn(sone);
                return sone;
        }
 
@@ -223,7 +220,7 @@ public class SoneInserterTest {
                                new SoneInserter(core, eventBus, freenetInterface, "SoneId",
                                                soneModificationDetector, 1);
                when(soneModificationDetector.isEligibleForInsert()).thenReturn(true);
-               when(core.getSone("SoneId")).thenReturn(Optional.<Sone>absent());
+               when(core.getSone("SoneId")).thenReturn(null);
                soneInserter.serviceRun();
        }
 
@@ -251,7 +248,7 @@ public class SoneInserterTest {
        @Test
        public void templateIsRenderedCorrectlyForManifestElement()
        throws IOException {
-               Map<String, Object> soneProperties = new HashMap<String, Object>();
+               Map<String, Object> soneProperties = new HashMap<>();
                soneProperties.put("id", "SoneId");
                ManifestCreator manifestCreator = new ManifestCreator(core, soneProperties);
                long now = currentTimeMillis();
@@ -267,7 +264,7 @@ public class SoneInserterTest {
 
        @Test
        public void invalidTemplateReturnsANullManifestElement() {
-               Map<String, Object> soneProperties = new HashMap<String, Object>();
+               Map<String, Object> soneProperties = new HashMap<>();
                ManifestCreator manifestCreator = new ManifestCreator(core, soneProperties);
                assertThat(manifestCreator.createManifestElement("test.txt",
                                "plain/text; charset=utf-8",
@@ -277,7 +274,7 @@ public class SoneInserterTest {
 
        @Test
        public void errorWhileRenderingTemplateReturnsANullManifestElement() {
-               Map<String, Object> soneProperties = new HashMap<String, Object>();
+               Map<String, Object> soneProperties = new HashMap<>();
                ManifestCreator manifestCreator = new ManifestCreator(core, soneProperties);
                when(core.toString()).thenThrow(NullPointerException.class);
                assertThat(manifestCreator.createManifestElement("test.txt",