16
16
package org .springframework .data .domain ;
17
17
18
18
import static org .assertj .core .api .Assertions .*;
19
- import static org .hamcrest .Matchers .*;
20
19
import static org .springframework .data .domain .ExampleMatcher .*;
21
20
22
21
import org .junit .Before ;
@@ -34,77 +33,77 @@ public class ExampleMatcherUnitTests {
34
33
ExampleMatcher matcher ;
35
34
36
35
@ Before
37
- public void setUp () throws Exception {
36
+ public void setUp () {
38
37
matcher = matching ();
39
38
}
40
39
41
40
@ Test // DATACMNS-810
42
- public void defaultStringMatcherShouldReturnDefault () throws Exception {
41
+ public void defaultStringMatcherShouldReturnDefault () {
43
42
assertThat (matcher .getDefaultStringMatcher ()).isEqualTo (StringMatcher .DEFAULT );
44
43
}
45
44
46
45
@ Test // DATACMNS-810
47
- public void ignoreCaseShouldReturnFalseByDefault () throws Exception {
46
+ public void ignoreCaseShouldReturnFalseByDefault () {
48
47
assertThat (matcher .isIgnoreCaseEnabled ()).isFalse ();
49
48
}
50
49
51
50
@ Test // DATACMNS-810
52
- public void ignoredPathsIsEmptyByDefault () throws Exception {
51
+ public void ignoredPathsIsEmptyByDefault () {
53
52
assertThat (matcher .getIgnoredPaths ()).isEmpty ();
54
53
}
55
54
56
55
@ Test // DATACMNS-810
57
- public void nullHandlerShouldReturnIgnoreByDefault () throws Exception {
56
+ public void nullHandlerShouldReturnIgnoreByDefault () {
58
57
assertThat (matcher .getNullHandler ()).isEqualTo (NullHandler .IGNORE );
59
58
}
60
59
61
60
@ Test (expected = UnsupportedOperationException .class ) // DATACMNS-810
62
- public void ignoredPathsIsNotModifiable () throws Exception {
61
+ public void ignoredPathsIsNotModifiable () {
63
62
matcher .getIgnoredPaths ().add ("¯\\ _(ツ)_/¯" );
64
63
}
65
64
66
65
@ Test // DATACMNS-810
67
- public void ignoreCaseShouldReturnTrueWhenIgnoreCaseEnabled () throws Exception {
66
+ public void ignoreCaseShouldReturnTrueWhenIgnoreCaseEnabled () {
68
67
69
68
matcher = matching ().withIgnoreCase ();
70
69
71
70
assertThat (matcher .isIgnoreCaseEnabled ()).isTrue ();
72
71
}
73
72
74
73
@ Test // DATACMNS-810
75
- public void ignoreCaseShouldReturnTrueWhenIgnoreCaseSet () throws Exception {
74
+ public void ignoreCaseShouldReturnTrueWhenIgnoreCaseSet () {
76
75
77
76
matcher = matching ().withIgnoreCase (true );
78
77
79
78
assertThat (matcher .isIgnoreCaseEnabled ()).isTrue ();
80
79
}
81
80
82
81
@ Test // DATACMNS-810
83
- public void nullHandlerShouldReturnInclude () throws Exception {
82
+ public void nullHandlerShouldReturnInclude () {
84
83
85
84
matcher = matching ().withIncludeNullValues ();
86
85
87
86
assertThat (matcher .getNullHandler ()).isEqualTo (NullHandler .INCLUDE );
88
87
}
89
88
90
89
@ Test // DATACMNS-810
91
- public void nullHandlerShouldReturnIgnore () throws Exception {
90
+ public void nullHandlerShouldReturnIgnore () {
92
91
93
92
matcher = matching ().withIgnoreNullValues ();
94
93
95
94
assertThat (matcher .getNullHandler ()).isEqualTo (NullHandler .IGNORE );
96
95
}
97
96
98
97
@ Test // DATACMNS-810
99
- public void nullHandlerShouldReturnConfiguredValue () throws Exception {
98
+ public void nullHandlerShouldReturnConfiguredValue () {
100
99
101
100
matcher = matching ().withNullHandler (NullHandler .INCLUDE );
102
101
103
102
assertThat (matcher .getNullHandler ()).isEqualTo (NullHandler .INCLUDE );
104
103
}
105
104
106
105
@ Test // DATACMNS-810
107
- public void ignoredPathsShouldReturnCorrectProperties () throws Exception {
106
+ public void ignoredPathsShouldReturnCorrectProperties () {
108
107
109
108
matcher = matching ().withIgnorePaths ("foo" , "bar" , "baz" );
110
109
@@ -113,7 +112,7 @@ public void ignoredPathsShouldReturnCorrectProperties() throws Exception {
113
112
}
114
113
115
114
@ Test // DATACMNS-810
116
- public void ignoredPathsShouldReturnUniqueProperties () throws Exception {
115
+ public void ignoredPathsShouldReturnUniqueProperties () {
117
116
118
117
matcher = matching ().withIgnorePaths ("foo" , "bar" , "foo" );
119
118
@@ -122,12 +121,12 @@ public void ignoredPathsShouldReturnUniqueProperties() throws Exception {
122
121
}
123
122
124
123
@ Test // DATACMNS-810
125
- public void withCreatesNewInstance () throws Exception {
124
+ public void withCreatesNewInstance () {
126
125
127
126
matcher = matching ().withIgnorePaths ("foo" , "bar" , "foo" );
128
127
ExampleMatcher configuredExampleSpec = matcher .withIgnoreCase ();
129
128
130
- assertThat (matcher ).isNotEqualTo ( sameInstance ( configuredExampleSpec ) );
129
+ assertThat (matcher ).isNotSameAs ( configuredExampleSpec );
131
130
assertThat (matcher .getIgnoredPaths ()).hasSize (2 );
132
131
assertThat (matcher .isIgnoreCaseEnabled ()).isFalse ();
133
132
@@ -157,31 +156,29 @@ public void anyMatcherYieldsAnyMatching() {
157
156
}
158
157
159
158
@ Test // DATACMNS-900
160
- public void shouldCompareUsingHashCodeAndEquals () throws Exception {
159
+ public void shouldCompareUsingHashCodeAndEquals () {
161
160
162
161
matcher = matching () //
163
162
.withIgnorePaths ("foo" , "bar" , "baz" ) //
164
163
.withNullHandler (NullHandler .IGNORE ) //
165
164
.withIgnoreCase ("ignored-case" ) //
166
165
.withMatcher ("hello" , GenericPropertyMatchers .contains ().caseSensitive ()) //
167
- .withMatcher ("world" , matcher -> matcher . endsWith () );
166
+ .withMatcher ("world" , GenericPropertyMatcher :: endsWith );
168
167
169
168
ExampleMatcher sameAsMatcher = matching () //
170
169
.withIgnorePaths ("foo" , "bar" , "baz" ) //
171
170
.withNullHandler (NullHandler .IGNORE ) //
172
171
.withIgnoreCase ("ignored-case" ) //
173
172
.withMatcher ("hello" , GenericPropertyMatchers .contains ().caseSensitive ()) //
174
- .withMatcher ("world" , matcher -> matcher . endsWith () );
173
+ .withMatcher ("world" , GenericPropertyMatcher :: endsWith );
175
174
176
175
ExampleMatcher different = matching () //
177
176
.withIgnorePaths ("foo" , "bar" , "baz" ) //
178
177
.withNullHandler (NullHandler .IGNORE ) //
179
178
.withMatcher ("hello" , GenericPropertyMatchers .contains ().ignoreCase ());
180
179
181
- assertThat (matcher .hashCode ()).isEqualTo (sameAsMatcher .hashCode ());
182
- assertThat (matcher .hashCode ()).isNotEqualTo (different .hashCode ());
183
- assertThat (matcher ).isEqualTo (sameAsMatcher );
184
- assertThat (matcher ).isNotEqualTo (different );
180
+ assertThat (matcher .hashCode ()).isEqualTo (sameAsMatcher .hashCode ()).isNotEqualTo (different .hashCode ());
181
+ assertThat (matcher ).isEqualTo (sameAsMatcher ).isNotEqualTo (different );
185
182
}
186
183
187
184
static class Person {
0 commit comments