18
18
19
19
import java .util .function .Supplier ;
20
20
21
+ import org .assertj .core .api .Assertions ;
21
22
import org .junit .jupiter .api .Test ;
22
23
23
24
import static org .assertj .core .api .Assertions .assertThat ;
24
25
import static org .assertj .core .api .Assertions .assertThatIllegalArgumentException ;
25
- import static org .assertj .core .api .Assertions .fail ;
26
26
27
27
/**
28
28
* Tests for {@link PropertyMapper}.
@@ -57,7 +57,7 @@ void fromValueAsIntShouldAdaptValue() {
57
57
58
58
@ Test
59
59
void fromValueAlwaysApplyingWhenNonNullShouldAlwaysApplyNonNullToSource () {
60
- this .map .alwaysApplyingWhenNonNull ().from ((String ) null ).toCall (() -> fail () );
60
+ this .map .alwaysApplyingWhenNonNull ().from ((String ) null ).toCall (Assertions :: fail );
61
61
}
62
62
63
63
@ Test
@@ -101,14 +101,14 @@ void asShouldAdaptSupplier() {
101
101
102
102
@ Test
103
103
void whenNonNullWhenSuppliedNullShouldNotMap () {
104
- this .map .from (() -> null ).whenNonNull ().as (String ::valueOf ).toCall (() -> fail () );
104
+ this .map .from (() -> null ).whenNonNull ().as (String ::valueOf ).toCall (Assertions :: fail );
105
105
}
106
106
107
107
@ Test
108
108
void whenNonNullWhenSuppliedThrowsNullPointerExceptionShouldNotMap () {
109
109
this .map .from (() -> {
110
110
throw new NullPointerException ();
111
- }).whenNonNull ().as (String ::valueOf ).toCall (() -> fail () );
111
+ }).whenNonNull ().as (String ::valueOf ).toCall (Assertions :: fail );
112
112
}
113
113
114
114
@ Test
@@ -119,7 +119,7 @@ void whenTrueWhenValueIsTrueShouldMap() {
119
119
120
120
@ Test
121
121
void whenTrueWhenValueIsFalseShouldNotMap () {
122
- this .map .from (false ).whenTrue ().toCall (() -> fail () );
122
+ this .map .from (false ).whenTrue ().toCall (Assertions :: fail );
123
123
}
124
124
125
125
@ Test
@@ -130,17 +130,17 @@ void whenFalseWhenValueIsFalseShouldMap() {
130
130
131
131
@ Test
132
132
void whenFalseWhenValueIsTrueShouldNotMap () {
133
- this .map .from (true ).whenFalse ().toCall (() -> fail () );
133
+ this .map .from (true ).whenFalse ().toCall (Assertions :: fail );
134
134
}
135
135
136
136
@ Test
137
137
void whenHasTextWhenValueIsNullShouldNotMap () {
138
- this .map .from (() -> null ).whenHasText ().toCall (() -> fail () );
138
+ this .map .from (() -> null ).whenHasText ().toCall (Assertions :: fail );
139
139
}
140
140
141
141
@ Test
142
142
void whenHasTextWhenValueIsEmptyShouldNotMap () {
143
- this .map .from ("" ).whenHasText ().toCall (() -> fail () );
143
+ this .map .from ("" ).whenHasText ().toCall (Assertions :: fail );
144
144
}
145
145
146
146
@ Test
@@ -157,7 +157,7 @@ void whenEqualToWhenValueIsEqualShouldMatch() {
157
157
158
158
@ Test
159
159
void whenEqualToWhenValueIsNotEqualShouldNotMatch () {
160
- this .map .from ("123" ).whenEqualTo ("321" ).toCall (() -> fail () );
160
+ this .map .from ("123" ).whenEqualTo ("321" ).toCall (Assertions :: fail );
161
161
}
162
162
163
163
@ Test
@@ -169,7 +169,7 @@ void whenInstanceOfWhenValueIsTargetTypeShouldMatch() {
169
169
@ Test
170
170
void whenInstanceOfWhenValueIsNotTargetTypeShouldNotMatch () {
171
171
Supplier <Number > supplier = () -> 123L ;
172
- this .map .from (supplier ).whenInstanceOf (Double .class ).toCall (() -> fail () );
172
+ this .map .from (supplier ).whenInstanceOf (Double .class ).toCall (Assertions :: fail );
173
173
}
174
174
175
175
@ Test
@@ -180,7 +180,7 @@ void whenWhenValueMatchesShouldMap() {
180
180
181
181
@ Test
182
182
void whenWhenValueDoesNotMatchShouldNotMap () {
183
- this .map .from ("123" ).when ("321" ::equals ).toCall (() -> fail () );
183
+ this .map .from ("123" ).when ("321" ::equals ).toCall (Assertions :: fail );
184
184
}
185
185
186
186
@ Test
@@ -198,12 +198,12 @@ void whenWhenCombinedWithAsUsesSourceValue() {
198
198
199
199
@ Test
200
200
void alwaysApplyingWhenNonNullShouldAlwaysApplyNonNullToSource () {
201
- this .map .alwaysApplyingWhenNonNull ().from (() -> null ).toCall (() -> fail () );
201
+ this .map .alwaysApplyingWhenNonNull ().from (() -> null ).toCall (Assertions :: fail );
202
202
}
203
203
204
204
@ Test
205
205
void whenWhenValueNotMatchesShouldSupportChainedCalls () {
206
- this .map .from ("123" ).when ("456" ::equals ).when ("123" ::equals ).toCall (() -> fail () );
206
+ this .map .from ("123" ).when ("456" ::equals ).when ("123" ::equals ).toCall (Assertions :: fail );
207
207
}
208
208
209
209
@ Test
0 commit comments