X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebPageTest.java;h=bb6282cfffa644f82ef5bdd9b3b645b3ab414e8c;hb=02bfd3cfcf4c78c4e7f561ef68dece9becaf8171;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..bb6282c 100644 --- a/src/test/java/net/pterodactylus/sone/web/WebPageTest.java +++ b/src/test/java/net/pterodactylus/sone/web/WebPageTest.java @@ -69,7 +69,10 @@ 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()); + when(core.getPost(anyString())).thenReturn(Optional.absent()); } @Before @@ -102,4 +105,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); + } + }