Requires N:M mapping.

This mapping has 1 multi-map group: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

This mapping has 4 all-to-all groups: every node on one side corresponds to every node on the other, and none is deleted or inserted. Each member carries an all N:M badge; selecting one highlights all of its counterparts, in the tree and in the code view alike.

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.defaultanswers;
6
7import java.io.Serializable;
8import java.lang.reflect.Method;
9
10import org.mockito.Mockito;
11import org.mockito.cglib.proxy.MethodInterceptor;
12import org.mockito.cglib.proxy.MethodProxy;
13import org.mockito.exceptions.Reporter;
14import org.mockito.internal.creation.jmock.ClassImposterizer;
…lines 15–52 unchanged (38 lines)
53 }
54
55 new Reporter().smartNullPointerException(location);
56 return null;
57 }
58
59 private String formatMethodCall() {
60 return invocation.getMethod().getName() + "()";
61 }
62 }
63
64 private final Answer<Object> delegate = new ReturnsMoreEmptyValues();
65
66 public Object answer(final InvocationOnMock invocation) throws Throwable {
…lines 67–78 unchanged (12 lines)

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.defaultanswers;
6
7import java.io.Serializable;
8import java.lang.reflect.Method;
9import java.util.Arrays;
10
11import org.mockito.Mockito;
12import org.mockito.cglib.proxy.MethodInterceptor;
13import org.mockito.cglib.proxy.MethodProxy;
14import org.mockito.exceptions.Reporter;
15import org.mockito.internal.creation.jmock.ClassImposterizer;
…lines 16–54 unchanged (39 lines)
55
56 new Reporter().smartNullPointerException(location);
57 return null;
58 }
59
60 private String formatMethodCall() {
61 String args = Arrays.toString(invocation.getArguments());
62 return invocation.getMethod().getName() + "(" + args.substring(1, args.length() - 1) + ")";
63 }
64 }
65
66 private final Answer<Object> delegate = new ReturnsMoreEmptyValues();
67
68 public Object answer(final InvocationOnMock invocation) throws Throwable {
…lines 69–80 unchanged (12 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 "defaultanswers"
; ";"
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 "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "Mockito"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "cglib"
. "."
identifier "proxy"
. "."
identifier "MethodInterceptor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "cglib"
. "."
identifier "proxy"
. "."
identifier "MethodProxy"
; ";"
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
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "creation"
. "."
identifier "jmock"
. "."
identifier "ClassImposterizer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "debugging"
. "."
identifier "Location"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "util"
. "."
identifier "ObjectMethodsGuru"
; ";"
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 can be used with\r\n * {@link Moc"...
class_declaration
modifiers
public "public"
class "class"
identifier "ReturnsSmartNulls"
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 "7618312406617949441L"
; ";"
class_declaration
modifiers
private "private"
final "final"
class "class"
identifier "ThrowingInterceptor"
super_interfaces
implements "implements"
type_list
type_identifier "MethodInterceptor"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "InvocationOnMock"
variable_declarator
identifier "invocation"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Location"
variable_declarator
identifier "location"
= "="
object_creation_expression
new "new"
type_identifier "Location"
argument_list
( "("
) ")"
; ";"
constructor_declaration (+22 nodes collapsed)
method_declaration (+93 nodes collapsed)
method_declaration
modifiers
private "private"
type_identifier "String"
identifier "formatMethodCall"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
binary_expression any 1:3
method_invocation
method_invocation
identifier "invocation"
. "."
identifier "getMethod"
argument_list
( "("
) ")"
. "."
identifier "getName"
argument_list
( "("
) ")"
+ "+"
string_literal all 1:2
" "\"" all 1:2
string_fragment "()" all 1:2
" "\"" all 1:2
; ";"
} "}"
} "}"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Answer"
type_arguments
< "<"
type_identifier "Object"
> ">"
variable_declarator
identifier "delegate"
= "="
object_creation_expression
new "new"
type_identifier "ReturnsMoreEmptyValues"
argument_list
( "("
) ")"
; ";"
method_declaration (+119 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 "defaultanswers"
; ";"
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 "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "Mockito"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "cglib"
. "."
identifier "proxy"
. "."
identifier "MethodInterceptor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "cglib"
. "."
identifier "proxy"
. "."
identifier "MethodProxy"
; ";"
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
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "creation"
. "."
identifier "jmock"
. "."
identifier "ClassImposterizer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "debugging"
. "."
identifier "Location"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "mockito"
. "."
identifier "internal"
. "."
identifier "util"
. "."
identifier "ObjectMethodsGuru"
; ";"
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 can be used with\r\n * {@link Moc"...
class_declaration
modifiers
public "public"
class "class"
identifier "ReturnsSmartNulls"
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 "7618312406617949441L"
; ";"
class_declaration
modifiers
private "private"
final "final"
class "class"
identifier "ThrowingInterceptor"
super_interfaces
implements "implements"
type_list
type_identifier "MethodInterceptor"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "InvocationOnMock"
variable_declarator
identifier "invocation"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Location"
variable_declarator
identifier "location"
= "="
object_creation_expression
new "new"
type_identifier "Location"
argument_list
( "("
) ")"
; ";"
constructor_declaration (+22 nodes collapsed)
method_declaration (+93 nodes collapsed)
method_declaration
modifiers
private "private"
type_identifier "String"
identifier "formatMethodCall"
formal_parameters
( "("
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "args"
= "="
method_invocation
identifier "Arrays"
. "."
identifier "toString"
argument_list
( "("
method_invocation
identifier "invocation"
. "."
identifier "getArguments"
argument_list
( "("
) ")"
) ")"
; ";"
return_statement
return "return"
binary_expression any 1:3
binary_expression any 1:3
binary_expression any 1:3
method_invocation
method_invocation
identifier "invocation"
. "."
identifier "getMethod"
argument_list
( "("
) ")"
. "."
identifier "getName"
argument_list
( "("
) ")"
+ "+"
string_literal all 1:2
" "\"" all 1:2
string_fragment "(" all 1:2
" "\"" all 1:2
+ "+"
method_invocation
identifier "args"
. "."
identifier "substring"
argument_list
( "("
decimal_integer_literal "1"
, ","
binary_expression
method_invocation
identifier "args"
. "."
identifier "length"
argument_list
( "("
) ")"
- "-"
decimal_integer_literal "1"
) ")"
+ "+"
string_literal all 1:2
" "\"" all 1:2
string_fragment ")" all 1:2
" "\"" all 1:2
; ";"
} "}"
} "}"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Answer"
type_arguments
< "<"
type_identifier "Object"
> ">"
variable_declarator
identifier "delegate"
= "="
object_creation_expression
new "new"
type_identifier "ReturnsMoreEmptyValues"
argument_list
( "("
) ")"
; ";"
method_declaration (+119 nodes collapsed)
} "}"