From aed9937d8f5d5b333560399e1f909fa079eb0507 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 4 Dec 2014 22:39:01 +0100 Subject: [PATCH] Fix SoneInserter test. --- src/test/java/net/pterodactylus/sone/core/SoneInserterTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.7.4