X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebPageTest.java;h=6f99879bf6d7f445ed82d0ad064372dabee02b50;hb=297f82af626284ebfefa80060ff62a35d61f40ca;hp=a1af8cc9b5bc3c0fb497d8a712335349cee8a7e0;hpb=05cb6903f37f8166eab0ca2244b2cac7f06a6a52;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 a1af8cc..6f99879 100644 --- a/src/test/java/net/pterodactylus/sone/web/WebPageTest.java +++ b/src/test/java/net/pterodactylus/sone/web/WebPageTest.java @@ -164,6 +164,13 @@ public abstract class WebPageTest { return requestParameters.containsKey(parameter) ? requestParameters.get(parameter).iterator().next() : invocation.getArgument(1); } }); + when(httpRequest.isParameterSet(anyString())).thenAnswer(new Answer() { + @Override + public Boolean answer(InvocationOnMock invocation) throws Throwable { + return requestParameters.containsKey(invocation.getArgument(0)) && + requestParameters.get(invocation.getArgument(0)).iterator().next() != null; + } + }); when(httpRequest.isPartSet(anyString())).thenAnswer(new Answer() { @Override public Boolean answer(InvocationOnMock invocation) throws Throwable { @@ -236,6 +243,7 @@ public abstract class WebPageTest { } }); when(core.getPost(anyString())).thenReturn(Optional.absent()); + when(core.getPostReply(anyString())).thenReturn(Optional.absent()); when(core.getReplies(anyString())).thenAnswer(new Answer>() { @Override public List answer(InvocationOnMock invocation) throws Throwable { @@ -265,8 +273,8 @@ public abstract class WebPageTest { @Before public final void setupWebInterface() { - when(webInterface.getCurrentSone(toadletContext)).thenReturn(currentSone); - when(webInterface.getCurrentSone(eq(toadletContext), anyBoolean())).thenReturn(currentSone); + when(webInterface.getCurrentSoneCreatingSession(toadletContext)).thenReturn(currentSone); + when(webInterface.getCurrentSoneWithoutCreatingSession(toadletContext)).thenReturn(currentSone); when(webInterface.getNotification(anyString())).thenReturn(Optional.absent()); when(webInterface.getNotifications(currentSone)).thenReturn(new ArrayList()); } @@ -281,8 +289,8 @@ public abstract class WebPageTest { } protected void unsetCurrentSone() { - when(webInterface.getCurrentSone(toadletContext)).thenReturn(null); - when(webInterface.getCurrentSone(eq(toadletContext), anyBoolean())).thenReturn(null); + when(webInterface.getCurrentSoneCreatingSession(toadletContext)).thenReturn(null); + when(webInterface.getCurrentSoneWithoutCreatingSession(toadletContext)).thenReturn(null); } protected void request(String uri, Method method) {