From 8f1bb4ea4f3303ece1a30eb063c819e53cd4bd7e Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:28:21 +0100 Subject: [PATCH] fixed files form Mockito #37 --- .../internal/stubbing/answers/AnswersValidator.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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()) {