private MockeryMetadata mockeryMetadata(Class<?> mockingClass, Method method, Object[] args, Type type, Annotation[] annotations) { List<MockeryMetadata> mockeriesMetadata = new ArrayList<>(); for (Annotation annotation : annotations) { Mockery mockeryAnnotation = annotation.annotationType() .getAnnotation(Mockery.class); if (mockeryAnnotation == null) continue; Metadata metadata = new Metadata<>(mockingClass, method, args, annotation, type); Mockery.Behaviour mockery = instantiateInterface.from(mockeryAnnotation.value()); mockeriesMetadata.add(new MockeryMetadata(metadata, mockery)); } if (mockeriesMetadata.isEmpty()) return null; if (mockeriesMetadata.size() > 1) { String message = Messages .multipleMockeryOnMethodOrParam(mockingClass, method); throw new IllegalArgumentException(message); } return mockeriesMetadata.get(0); }