forked from mockito/mockito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContainsExtraTypeInfo.java
37 lines (32 loc) · 1.24 KB
/
ContainsExtraTypeInfo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.matchers;
/**
* Intended to use in certain ArgumentMatchers.
* When ArgumentMatcher fails, chance is that the actual object has the same output of toString() than
* the wanted object. This looks weird when failures are reported.
* Therefore when matcher fails but toString() yields the same outputs,
* we will try to use the {@link #toStringWithType()} method.
*/
public interface ContainsExtraTypeInfo {
/**
* Returns more verbose description of the object which include type information
*/
String toStringWithType();
/**
* Returns more verbose description of the object which include type information and fully qualified class name
*/
String toStringWithFullName();
/**
* Checks if target target has matching type.
* If the type matches, there is no point in rendering result from {@link #toStringWithType()}
*/
boolean typeMatches(Object target);
/**
* Checks if target target's class has same simple name.
* If the simple names matches, we need to use {@link #toStringWithFullName()}
*/
boolean sameName(Object target);
}