From: David ‘Bombe’ Roden Date: Mon, 28 Oct 2013 20:50:54 +0000 (+0100) Subject: Don’t use an argument captor when using an answer. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=02bf56efeee6654cd6ed0b92074e09180b7fb0b6;p=Sone.git Don’t use an argument captor when using an answer. --- diff --git a/src/test/java/net/pterodactylus/sone/data/Mocks.java b/src/test/java/net/pterodactylus/sone/data/Mocks.java index e1b9102..34aff9b 100644 --- a/src/test/java/net/pterodactylus/sone/data/Mocks.java +++ b/src/test/java/net/pterodactylus/sone/data/Mocks.java @@ -63,11 +63,10 @@ public class Mocks { when(sone.isLocal()).thenReturn(true); final Database database = core.getDatabase(); when(sone.newPostBuilder()).thenReturn(new DefaultPostBuilder(database, id)); - final ArgumentCaptor postIdCaptor = forClass(String.class); - when(sone.newPostReplyBuilder(postIdCaptor.capture())).then(new Answer() { + when(sone.newPostReplyBuilder(anyString())).then(new Answer() { @Override - public PostReplyBuilder answer(InvocationOnMock invocationOnMock) throws Throwable { - return new DefaultPostReplyBuilder(database, id, postIdCaptor.getValue()); + public PostReplyBuilder answer(InvocationOnMock invocation) throws Throwable { + return new DefaultPostReplyBuilder(database, id, (String) invocation.getArguments()[0]); } }); return sone;