public InvocationMatcher bindMatchers(ArgumentMatcherStorage argumentMatcherStorage, final Invocation invocation) { List<LocalizedMatcher> lastMatchers = argumentMatcherStorage.pullLocalizedMatchers(); validateMatchers(invocation, lastMatchers); final InvocationMatcher invocationWithMatchers = new InvocationMatcher(invocation, (List<Matcher>)(List) lastMatchers) { @Override public String toString() { return invocation.toString(); } }; return invocationWithMatchers; }
private MockHandler replaceMatchersBinderIfNeeded(MockHandler mockHandler) { if(!Whitebox.getFieldsOfType(mockHandler, MatchersBinder.class).isEmpty()) { Whitebox.setInternalState(mockHandler, new PowerMockMatchersBinder()); } else if(!Whitebox.getFieldsOfType(mockHandler, InternalMockHandler.class).isEmpty()) { final MockHandler internalMockHandler = Whitebox.getInternalState(mockHandler, MockHandler.class); return replaceMatchersBinderIfNeeded(internalMockHandler); } return mockHandler; }