From: David ‘Bombe’ Roden Date: Thu, 4 Dec 2014 21:39:01 +0000 (+0100) Subject: Fix SoneInserter test. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=aed9937d8f5d5b333560399e1f909fa079eb0507;p=Sone.git Fix SoneInserter test. --- diff --git a/src/test/java/net/pterodactylus/sone/core/SoneInserterTest.java b/src/test/java/net/pterodactylus/sone/core/SoneInserterTest.java index e0ff3a5..8a4bd52 100644 --- a/src/test/java/net/pterodactylus/sone/core/SoneInserterTest.java +++ b/src/test/java/net/pterodactylus/sone/core/SoneInserterTest.java @@ -20,6 +20,7 @@ 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.Mockito.withSettings; import java.io.IOException; import java.util.HashMap; @@ -33,6 +34,7 @@ import net.pterodactylus.sone.core.event.SoneInsertAbortedEvent; import net.pterodactylus.sone.core.event.SoneInsertedEvent; import net.pterodactylus.sone.core.event.SoneInsertingEvent; import net.pterodactylus.sone.data.Album; +import net.pterodactylus.sone.data.LocalSone; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.main.SonePlugin; @@ -65,6 +67,7 @@ public class SoneInserterTest { UpdateChecker updateChecker = mock(UpdateChecker.class); when(core.getUpdateChecker()).thenReturn(updateChecker); when(core.getSone(anyString())).thenReturn(Optional.absent()); + when(core.getLocalSone(anyString())).thenReturn(Optional.absent()); } @Test @@ -76,11 +79,12 @@ public class SoneInserterTest { } private Sone createSone(FreenetURI insertUri, String fingerprint) { - Sone sone = mock(Sone.class); + Sone sone = mock(Sone.class, withSettings().extraInterfaces(LocalSone.class)); 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.getLocalSone(anyString())).thenReturn(of((LocalSone) sone)); return sone; }