17
17
18
18
import static examples .simple .SimpleTableDynamicSqlSupport .*;
19
19
import static org .assertj .core .api .Assertions .assertThat ;
20
+ import static org .junit .jupiter .api .Assertions .assertAll ;
20
21
import static org .mybatis .dynamic .sql .SqlBuilder .*;
21
22
22
23
import java .io .InputStream ;
35
36
import org .apache .ibatis .session .SqlSessionFactory ;
36
37
import org .apache .ibatis .session .SqlSessionFactoryBuilder ;
37
38
import org .apache .ibatis .transaction .jdbc .JdbcTransactionFactory ;
38
- import org .assertj .core .api .SoftAssertions ;
39
39
import org .junit .jupiter .api .BeforeEach ;
40
40
import org .junit .jupiter .api .Test ;
41
41
import org .junit .platform .runner .JUnitPlatform ;
@@ -141,11 +141,11 @@ public void testSelectByExampleWithTypeHandler() {
141
141
.build ()
142
142
.execute ();
143
143
144
- SoftAssertions . assertSoftly ( softly -> {
145
- softly . assertThat (rows .size ()).isEqualTo (2 );
146
- softly . assertThat (rows .get (0 ).getId ()).isEqualTo (3 );
147
- softly . assertThat (rows .get (1 ).getId ()).isEqualTo (6 );
148
- } );
144
+ assertAll (
145
+ () -> assertThat (rows .size ()).isEqualTo (2 ),
146
+ () -> assertThat (rows .get (0 ).getId ()).isEqualTo (3 ),
147
+ () -> assertThat (rows .get (1 ).getId ()).isEqualTo (6 )
148
+ );
149
149
}
150
150
}
151
151
@@ -159,9 +159,11 @@ public void testFirstNameIn() {
159
159
.build ()
160
160
.execute ();
161
161
162
- assertThat (rows .size ()).isEqualTo (2 );
163
- assertThat (rows .get (0 ).getLastName ().getName ()).isEqualTo ("Flintstone" );
164
- assertThat (rows .get (1 ).getLastName ().getName ()).isEqualTo ("Rubble" );
162
+ assertAll (
163
+ () -> assertThat (rows .size ()).isEqualTo (2 ),
164
+ () -> assertThat (rows .get (0 ).getLastName ().getName ()).isEqualTo ("Flintstone" ),
165
+ () -> assertThat (rows .get (1 ).getLastName ().getName ()).isEqualTo ("Rubble" )
166
+ );
165
167
}
166
168
}
167
169
@@ -232,17 +234,15 @@ public void testUpdateByPrimaryKey() {
232
234
record .setEmployed (true );
233
235
record .setOccupation ("Developer" );
234
236
235
- SoftAssertions .assertSoftly (softly -> {
236
- int rows = mapper .insert (record );
237
- softly .assertThat (rows ).isEqualTo (1 );
237
+ int rows = mapper .insert (record );
238
+ assertThat (rows ).isEqualTo (1 );
238
239
239
- record .setOccupation ("Programmer" );
240
- rows = mapper .updateByPrimaryKey (record );
241
- softly . assertThat (rows ).isEqualTo (1 );
240
+ record .setOccupation ("Programmer" );
241
+ rows = mapper .updateByPrimaryKey (record );
242
+ assertThat (rows ).isEqualTo (1 );
242
243
243
- SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
244
- softly .assertThat (newRecord .getOccupation ()).isEqualTo ("Programmer" );
245
- });
244
+ SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
245
+ assertThat (newRecord .getOccupation ()).isEqualTo ("Programmer" );
246
246
}
247
247
}
248
248
@@ -258,20 +258,18 @@ public void testUpdateByPrimaryKeySelective() {
258
258
record .setEmployed (true );
259
259
record .setOccupation ("Developer" );
260
260
261
- SoftAssertions .assertSoftly (softly -> {
262
- int rows = mapper .insert (record );
263
- softly .assertThat (rows ).isEqualTo (1 );
261
+ int rows = mapper .insert (record );
262
+ assertThat (rows ).isEqualTo (1 );
264
263
265
- SimpleTableRecord updateRecord = new SimpleTableRecord ();
266
- updateRecord .setId (100 );
267
- updateRecord .setOccupation ("Programmer" );
268
- rows = mapper .updateByPrimaryKeySelective (updateRecord );
269
- softly . assertThat (rows ).isEqualTo (1 );
264
+ SimpleTableRecord updateRecord = new SimpleTableRecord ();
265
+ updateRecord .setId (100 );
266
+ updateRecord .setOccupation ("Programmer" );
267
+ rows = mapper .updateByPrimaryKeySelective (updateRecord );
268
+ assertThat (rows ).isEqualTo (1 );
270
269
271
- SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
272
- softly .assertThat (newRecord .getOccupation ()).isEqualTo ("Programmer" );
273
- softly .assertThat (newRecord .getFirstName ()).isEqualTo ("Joe" );
274
- });
270
+ SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
271
+ assertThat (newRecord .getOccupation ()).isEqualTo ("Programmer" );
272
+ assertThat (newRecord .getFirstName ()).isEqualTo ("Joe" );
275
273
}
276
274
}
277
275
@@ -287,25 +285,25 @@ public void testUpdateWithNulls() {
287
285
record .setEmployed (true );
288
286
record .setOccupation ("Developer" );
289
287
290
- SoftAssertions .assertSoftly (softly -> {
291
- int rows = mapper .insert (record );
292
- softly .assertThat (rows ).isEqualTo (1 );
288
+ int rows = mapper .insert (record );
289
+ assertThat (rows ).isEqualTo (1 );
293
290
294
- UpdateStatementProvider updateStatement = update (simpleTable )
295
- .set (occupation ).equalToNull ()
296
- .set (employed ).equalTo (false )
297
- .where (id , isEqualTo (100 ))
298
- .build ()
299
- .render (RenderingStrategy .MYBATIS3 );
291
+ UpdateStatementProvider updateStatement = update (simpleTable )
292
+ .set (occupation ).equalToNull ()
293
+ .set (employed ).equalTo (false )
294
+ .where (id , isEqualTo (100 ))
295
+ .build ()
296
+ .render (RenderingStrategy .MYBATIS3 );
300
297
301
- rows = mapper .update (updateStatement );
302
- softly . assertThat (rows ).isEqualTo (1 );
298
+ rows = mapper .update (updateStatement );
299
+ assertThat (rows ).isEqualTo (1 );
303
300
304
- SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
305
- softly .assertThat (newRecord .getOccupation ()).isNull ();
306
- softly .assertThat (newRecord .getEmployed ()).isEqualTo (false );
307
- softly .assertThat (newRecord .getFirstName ()).isEqualTo ("Joe" );
308
- });
301
+ SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
302
+ assertAll (
303
+ () -> assertThat (newRecord .getOccupation ()).isNull (),
304
+ () -> assertThat (newRecord .getEmployed ()).isEqualTo (false ),
305
+ () -> assertThat (newRecord .getFirstName ()).isEqualTo ("Joe" )
306
+ );
309
307
}
310
308
}
311
309
@@ -321,22 +319,20 @@ public void testUpdateByExample() {
321
319
record .setEmployed (true );
322
320
record .setOccupation ("Developer" );
323
321
324
- SoftAssertions .assertSoftly (softly -> {
325
- int rows = mapper .insert (record );
326
- softly .assertThat (rows ).isEqualTo (1 );
322
+ int rows = mapper .insert (record );
323
+ assertThat (rows ).isEqualTo (1 );
327
324
328
- record .setOccupation ("Programmer" );
329
- rows = mapper .updateByExample (record )
330
- .where (id , isEqualTo (100 ))
331
- .and (firstName , isEqualTo ("Joe" ))
332
- .build ()
333
- .execute ();
325
+ record .setOccupation ("Programmer" );
326
+ rows = mapper .updateByExample (record )
327
+ .where (id , isEqualTo (100 ))
328
+ .and (firstName , isEqualTo ("Joe" ))
329
+ .build ()
330
+ .execute ();
334
331
335
- softly . assertThat (rows ).isEqualTo (1 );
332
+ assertThat (rows ).isEqualTo (1 );
336
333
337
- SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
338
- softly .assertThat (newRecord .getOccupation ()).isEqualTo ("Programmer" );
339
- });
334
+ SimpleTableRecord newRecord = mapper .selectByPrimaryKey (100 );
335
+ assertThat (newRecord .getOccupation ()).isEqualTo ("Programmer" );
340
336
}
341
337
}
342
338
0 commit comments