Interestingly, the way that Mockito captures argument is afterwards! So you can basically write code like this:
mock.doSomething(actualArgument);
ArgumentCaptorargument = ArgumentCaptor.forClass(Person.class); verify(mock).doSomething(argument.capture()); assertEquals("John", argument.getValue().getName());
没有评论:
发表评论