X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebPageTest.java;h=271717446d0619fd95b0b1a08d78f897b69c1610;hb=4300ec11b26e9f5fab861ce8c8576df302360c87;hp=eefb641df3b1c45722a910947f4b66002d1444ec;hpb=a821184f9e7f54cb5b9ad18a213bbaea07d7d978;p=Sone.git diff --git a/src/test/java/net/pterodactylus/sone/web/WebPageTest.java b/src/test/java/net/pterodactylus/sone/web/WebPageTest.java index eefb641..2717174 100644 --- a/src/test/java/net/pterodactylus/sone/web/WebPageTest.java +++ b/src/test/java/net/pterodactylus/sone/web/WebPageTest.java @@ -69,7 +69,9 @@ public abstract class WebPageTest { @Before public final void setupCore() { UpdateChecker updateChecker = mock(UpdateChecker.class); - when(webInterface.getCore().getUpdateChecker()).thenReturn(updateChecker); + when(core.getUpdateChecker()).thenReturn(updateChecker); + when(core.getLocalSone(anyString())).thenReturn(null); + when(core.getSone(anyString())).thenReturn(Optional.absent()); } @Before @@ -102,4 +104,12 @@ public abstract class WebPageTest { when(core.getPost(postId)).thenReturn(Optional.fromNullable(post)); } + protected void addSone(String soneId, Sone sone) { + when(core.getSone(eq(soneId))).thenReturn(Optional.fromNullable(sone)); + } + + protected void addLocalSone(String soneId, Sone sone) { + when(core.getLocalSone(eq(soneId))).thenReturn(sone); + } + }