Remove @author tags
[Sone.git] / src / test / java / net / pterodactylus / sone / core / SoneInserterTest.java
index e0ff3a5..32926e8 100644 (file)
@@ -1,31 +1,28 @@
 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;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.instanceOf;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.nullValue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.mockito.hamcrest.MockitoHamcrest.argThat;
 
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import net.pterodactylus.sone.core.SoneInserter.InsertInformation;
 import net.pterodactylus.sone.core.SoneInserter.ManifestCreator;
 import net.pterodactylus.sone.core.event.InsertionDelayChangedEvent;
 import net.pterodactylus.sone.core.event.SoneEvent;
@@ -36,8 +33,8 @@ import net.pterodactylus.sone.data.Album;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.main.SonePlugin;
 
-import freenet.client.async.ManifestElement;
 import freenet.keys.FreenetURI;
+import freenet.support.api.ManifestElement;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.Optional;
@@ -51,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 {
 
@@ -64,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
@@ -80,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;
        }
 
@@ -225,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();
        }
 
@@ -262,7 +257,7 @@ public class SoneInserterTest {
                assertThat(manifestElement.getName(), is("test.txt"));
                assertThat(manifestElement.getMimeTypeOverride(), is("plain/text; charset=utf-8"));
                String templateContent = new String(toByteArray(manifestElement.getData().getInputStream()), Charsets.UTF_8);
-               assertThat(templateContent, containsString("Sone Version: " + SonePlugin.VERSION.toString() + "\n"));
+               assertThat(templateContent, containsString("Sone Version: " + SonePlugin.getPluginVersion() + "\n"));
                assertThat(templateContent, containsString("Core Startup: " + now + "\n"));
                assertThat(templateContent, containsString("Sone ID: " + "SoneId" + "\n"));
        }