void methodInvoked()

in core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java [226:244]


        void methodInvoked(Method method, Object[] arguments)
        {
            final ArgumentMatcher<?>[] matchersArray = argumentMatchers.toArray(new ArgumentMatcher[argumentMatchers
                    .size()]);
            argumentMatchers.clear();
            final RecordedInvocation invocation = new RecordedInvocation(method, arguments);
            if (ArrayUtils.isEmpty(matchersArray))
            {
                this.matcher = new ExactArgumentsMatcher(invocation);
            }
            else if (matchersArray.length == arguments.length)
            {
                this.matcher = new MatchingArgumentsMatcher(invocation, matchersArray);
            }
            else
            {
                throw new IllegalStateException("Either use exact arguments or argument matchers, but not both.");
            }
        }