Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–19 unchanged (19 lines)
20 if (answer instanceof Returns) {
21 validateReturnValue((Returns) answer, invocation);
22 }
23
24 if (answer instanceof DoesNothing) {
25 validateDoNothing((DoesNothing) answer, invocation);
26 }
27
28 }
29
30
31 private void validateDoNothing(DoesNothing answer, Invocation invocation) {
32 if (!invocation.isVoid()) {
33 reporter.onlyVoidMethodsCanBeSetToDoNothing();
34 }
…lines 35–65 unchanged (31 lines)

After

…lines 1–21 unchanged (21 lines)
22 }
23
24 if (answer instanceof DoesNothing) {
25 validateDoNothing((DoesNothing) answer, invocation);
26 }
27
28 if (answer instanceof CallsRealMethods) {
29 validateMockingConcreteClass((CallsRealMethods) answer, invocation);
30 }
31 }
32
33 private void validateMockingConcreteClass(CallsRealMethods answer, Invocation invocation) {
34 if (invocation.getMethod().getDeclaringClass().isInterface()) {
35 reporter.cannotCallRealMethodOnInterface();
36 }
37 }
38
39 private void validateDoNothing(DoesNothing answer, Invocation invocation) {
40 if (!invocation.isVoid()) {
41 reporter.onlyVoidMethodsCanBeSetToDoNothing();
42 }
43 }
…lines 44–73 unchanged (30 lines)

Before

program
block_comment "/*\r\n * Copyright (c) 2007 Mockito contributors\r\n * This prog"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "stubbing"
. "."
identifier "answers"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "exceptions"
. "."
identifier "Reporter"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "invocation"
. "."
identifier "Invocation"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "stubbing"
. "."
identifier "Answer"
; ";"
class_declaration
modifiers
public "public"
class "class"
identifier "AnswersValidator"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "Reporter"
variable_declarator
identifier "reporter"
= "="
object_creation_expression
new "new"
type_identifier "Reporter"
argument_list
( "("
) ")"
; ";"
method_declaration
modifiers
public "public"
void_type "void"
identifier "validate"
formal_parameters
( "("
formal_parameter
generic_type
type_identifier "Answer"
type_arguments
< "<"
wildcard
? "?"
> ">"
identifier "answer"
, ","
formal_parameter
type_identifier "Invocation"
identifier "invocation"
) ")"
block
{ "{"
if_statement (+26 nodes collapsed)
if_statement (+26 nodes collapsed)
if_statement (+26 nodes collapsed)
} "}"
method_declaration (+44 nodes collapsed)
method_declaration (+162 nodes collapsed)
method_declaration (+101 nodes collapsed)
} "}"

After

program
block_comment "/*\r\n * Copyright (c) 2007 Mockito contributors\r\n * This prog"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "stubbing"
. "."
identifier "answers"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "exceptions"
. "."
identifier "Reporter"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "invocation"
. "."
identifier "Invocation"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "stubbing"
. "."
identifier "Answer"
; ";"
class_declaration
modifiers
public "public"
class "class"
identifier "AnswersValidator"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "Reporter"
variable_declarator
identifier "reporter"
= "="
object_creation_expression
new "new"
type_identifier "Reporter"
argument_list
( "("
) ")"
; ";"
method_declaration
modifiers
public "public"
void_type "void"
identifier "validate"
formal_parameters
( "("
formal_parameter
generic_type
type_identifier "Answer"
type_arguments
< "<"
wildcard
? "?"
> ">"
identifier "answer"
, ","
formal_parameter
type_identifier "Invocation"
identifier "invocation"
) ")"
block
{ "{"
if_statement (+26 nodes collapsed)
if_statement (+26 nodes collapsed)
if_statement (+26 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
instanceof_expression
identifier "answer"
instanceof "instanceof"
type_identifier "CallsRealMethods"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "validateMockingConcreteClass"
argument_list
( "("
cast_expression
( "("
type_identifier "CallsRealMethods"
) ")"
identifier "answer"
, ","
identifier "invocation"
) ")"
; ";"
} "}"
} "}"
method_declaration
modifiers
private "private"
void_type "void"
identifier "validateMockingConcreteClass"
formal_parameters
( "("
formal_parameter
type_identifier "CallsRealMethods"
identifier "answer"
, ","
formal_parameter
type_identifier "Invocation"
identifier "invocation"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
method_invocation
method_invocation
identifier "invocation"
. "."
identifier "getMethod"
argument_list
( "("
) ")"
. "."
identifier "getDeclaringClass"
argument_list
( "("
) ")"
. "."
identifier "isInterface"
argument_list
( "("
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "reporter"
. "."
identifier "cannotCallRealMethodOnInterface"
argument_list
( "("
) ")"
; ";"
} "}"
} "}"
method_declaration (+44 nodes collapsed)
method_declaration (+162 nodes collapsed)
method_declaration (+101 nodes collapsed)
} "}"