diff --git a/projects/Mockito/37/org/mockito/internal/stubbing/answers/AnswersValidator.java b/projects/Mockito/37/org/mockito/internal/stubbing/answers/AnswersValidator.java index 5d80578..afaf14a 100644 --- a/projects/Mockito/37/org/mockito/internal/stubbing/answers/AnswersValidator.java +++ b/projects/Mockito/37/org/mockito/internal/stubbing/answers/AnswersValidator.java @@ -25,8 +25,16 @@ public void validate(Answer answer, Invocation invocation) { validateDoNothing((DoesNothing) answer, invocation); } + if (answer instanceof CallsRealMethods) { + validateMockingConcreteClass((CallsRealMethods) answer, invocation); + } } + private void validateMockingConcreteClass(CallsRealMethods answer, Invocation invocation) { + if (invocation.getMethod().getDeclaringClass().isInterface()) { + reporter.cannotCallRealMethodOnInterface(); + } + } private void validateDoNothing(DoesNothing answer, Invocation invocation) { if (!invocation.isVoid()) {