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

1/*
2 * Copyright (c) 2007 Mockito contributors
3 * This program is made available under the terms of the MIT License.
4 */
5package org.mockito.internal.stubbing.answers;
6
7import java.io.Serializable;
8
9import org.mockito.invocation.InvocationOnMock;
10import org.mockito.stubbing.Answer;
11
12/**
13 * Optional Answer that adds partial mocking support
14 * <p>
…lines 15–29 unchanged (15 lines)
30 * <p>
31 */
32public class CallsRealMethods implements Answer<Object>, Serializable {
33 private static final long serialVersionUID = 9057165148930624087L;
34
35 public Object answer(InvocationOnMock invocation) throws Throwable {
36 return invocation.callRealMethod();
37 }
38}

After

1/*
2 * Copyright (c) 2007 Mockito contributors
3 * This program is made available under the terms of the MIT License.
4 */
5package org.mockito.internal.stubbing.answers;
6
7import java.io.Serializable;
8import java.lang.reflect.Modifier;
9
10import org.mockito.internal.stubbing.defaultanswers.GloballyConfiguredAnswer;
11import org.mockito.invocation.InvocationOnMock;
12import org.mockito.stubbing.Answer;
13
14/**
15 * Optional Answer that adds partial mocking support
16 * <p>
…lines 17–31 unchanged (15 lines)
32 * <p>
33 */
34public class CallsRealMethods implements Answer<Object>, Serializable {
35 private static final long serialVersionUID = 9057165148930624087L;
36
37 public Object answer(InvocationOnMock invocation) throws Throwable {
38 if (Modifier.isAbstract(invocation.getMethod().getModifiers())) {
39 return new GloballyConfiguredAnswer().answer(invocation);
40 }
41 return invocation.callRealMethod();
42 }
43}

Before

program
block_comment "/*\n * Copyright (c) 2007 Mockito contributors\n * This progra"...
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
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "invocation"
. "."
identifier "InvocationOnMock"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "stubbing"
. "."
identifier "Answer"
; ";"
block_comment "/**\r\n * Optional Answer that adds partial mocking support\r\n "...
class_declaration
modifiers
public "public"
class "class"
identifier "CallsRealMethods"
super_interfaces
implements "implements"
type_list
generic_type
type_identifier "Answer"
type_arguments
< "<"
type_identifier "Object"
> ">"
, ","
type_identifier "Serializable"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "9057165148930624087L"
; ";"
method_declaration
modifiers
public "public"
type_identifier "Object"
identifier "answer"
formal_parameters
( "("
formal_parameter
type_identifier "InvocationOnMock"
identifier "invocation"
) ")"
throws
throws "throws"
type_identifier "Throwable"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "invocation"
. "."
identifier "callRealMethod"
argument_list
( "("
) ")"
; ";"
} "}"
} "}"

After

program
block_comment "/*\n * Copyright (c) 2007 Mockito contributors\n * This progra"...
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
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Modifier"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "stubbing"
. "."
identifier "defaultanswers"
. "."
identifier "GloballyConfiguredAnswer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "invocation"
. "."
identifier "InvocationOnMock"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "stubbing"
. "."
identifier "Answer"
; ";"
block_comment "/**\r\n * Optional Answer that adds partial mocking support\r\n "...
class_declaration
modifiers
public "public"
class "class"
identifier "CallsRealMethods"
super_interfaces
implements "implements"
type_list
generic_type
type_identifier "Answer"
type_arguments
< "<"
type_identifier "Object"
> ">"
, ","
type_identifier "Serializable"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "9057165148930624087L"
; ";"
method_declaration
modifiers
public "public"
type_identifier "Object"
identifier "answer"
formal_parameters
( "("
formal_parameter
type_identifier "InvocationOnMock"
identifier "invocation"
) ")"
throws
throws "throws"
type_identifier "Throwable"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "Modifier"
. "."
identifier "isAbstract"
argument_list
( "("
method_invocation
method_invocation
identifier "invocation"
. "."
identifier "getMethod"
argument_list
( "("
) ")"
. "."
identifier "getModifiers"
argument_list
( "("
) ")"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
object_creation_expression
new "new"
type_identifier "GloballyConfiguredAnswer"
argument_list
( "("
) ")"
. "."
identifier "answer"
argument_list
( "("
identifier "invocation"
) ")"
; ";"
} "}"
return_statement
return "return"
method_invocation
identifier "invocation"
. "."
identifier "callRealMethod"
argument_list
( "("
) ")"
; ";"
} "}"
} "}"