55import static org .hamcrest .CoreMatchers .is ;
66import static org .hamcrest .CoreMatchers .notNullValue ;
77import static org .hamcrest .MatcherAssert .assertThat ;
8- import static org .junit .jupiter .api .Assertions .assertEquals ;
9- import static org .junit .jupiter .api .Assertions .assertFalse ;
10- import static org .junit .jupiter .api .Assertions .assertNotNull ;
118import static org .junit .jupiter .api .Assertions .assertThrows ;
12- import static org .junit .jupiter .api .Assertions .assertTrue ;
139import static org .mockito .ArgumentMatchers .anyString ;
1410import static org .mockito .Mockito .mock ;
1511import static org .mockito .Mockito .times ;
@@ -75,7 +71,7 @@ class DomaAutoConfigurationTest {
7571 DataSourceAutoConfiguration .class ));
7672
7773 @ Test
78- void testAutoRegisteredConfig () {
74+ void autoRegisteredConfig () {
7975 this .contextRunner
8076 .run (context -> {
8177 Config config = context .getBean (Config .class );
@@ -104,7 +100,7 @@ void testAutoRegisteredConfig() {
104100 }
105101
106102 @ Test
107- void testConfigWithDomaConfigBuilder () {
103+ void configWithDomaConfigBuilder () {
108104 this .contextRunner
109105 .withUserConfiguration (ConfigBuilderConfigure .class )
110106 .run (context -> {
@@ -135,7 +131,7 @@ void testConfigWithDomaConfigBuilder() {
135131 }
136132
137133 @ Test
138- void testConfigWithConfig () {
134+ void configWithConfig () {
139135 this .contextRunner
140136 .withUserConfiguration (ConfigConfigure .class )
141137 .run (context -> {
@@ -166,17 +162,15 @@ void testConfigWithConfig() {
166162 }
167163
168164 @ Test
169- void testExceptionTranslationEnabledSpecifyFalse () {
165+ void exceptionTranslationEnabledSpecifyFalse () {
170166 this .contextRunner
171167 .withPropertyValues ("doma.exception-translation-enabled=false" )
172- .run (context -> {
173- assertThrows (NoSuchBeanDefinitionException .class ,
174- () -> context .getBean (PersistenceExceptionTranslator .class ));
175- });
168+ .run (context -> assertThrows (NoSuchBeanDefinitionException .class ,
169+ () -> context .getBean (PersistenceExceptionTranslator .class )));
176170 }
177171
178172 @ Test
179- void testExceptionTranslationEnabledSpecifyTrue () {
173+ void exceptionTranslationEnabledSpecifyTrue () {
180174 this .contextRunner
181175 .withPropertyValues ("doma.exception-translation-enabled=true" )
182176 .run (context -> {
@@ -188,7 +182,7 @@ void testExceptionTranslationEnabledSpecifyTrue() {
188182 }
189183
190184 @ Test
191- void testChangeDialect () {
185+ void changeDialect () {
192186 this .contextRunner
193187 .withPropertyValues ("doma.dialect=MYSQL" )
194188 .run (context -> {
@@ -198,7 +192,7 @@ void testChangeDialect() {
198192 }
199193
200194 @ Test
201- void testChangeMaxRows () {
195+ void changeMaxRows () {
202196 this .contextRunner
203197 .withPropertyValues ("doma.max-rows=100" )
204198 .run (context -> {
@@ -208,7 +202,7 @@ void testChangeMaxRows() {
208202 }
209203
210204 @ Test
211- void testSQLExceptionTranslator () {
205+ void sqlExceptionTranslator () {
212206 this .contextRunner
213207 .run (context -> {
214208 PersistenceExceptionTranslator translator = context
@@ -242,32 +236,34 @@ void testSQLExceptionTranslator() {
242236 }
243237
244238 @ Test
245- void testAutoRegisteredCriteriaAPI () {
239+ void autoRegisteredCriteriaAPI () {
246240 this .contextRunner
247241 .run (context -> {
248242 Entityql entityql = context .getBean (Entityql .class );
249- assertNotNull (entityql );
243+ org . assertj . core . api . Assertions . assertThat (entityql ). isNotNull ( );
250244 NativeSql nativeSql = context .getBean (NativeSql .class );
251- assertNotNull (nativeSql );
245+ org . assertj . core . api . Assertions . assertThat (nativeSql ). isNotNull ( );
252246 });
253247 }
254248
255249 @ Test
256- void testCriteriaAPIWithConfig () {
250+ void criteriaAPIWithConfig () {
257251 this .contextRunner
258252 .withUserConfiguration (MyCriteriaAPIConfig .class )
259253 .run (context -> {
260254 Map <String , Entityql > entityqlBeans = context .getBeansOfType (Entityql .class );
261- assertEquals (1 , entityqlBeans .size ());
262- assertNotNull (entityqlBeans .get ("myEntityql" ));
255+ org .assertj .core .api .Assertions .assertThat (entityqlBeans .size ()).isEqualTo (1 );
256+ org .assertj .core .api .Assertions .assertThat (entityqlBeans .get ("myEntityql" ))
257+ .isNotNull ();
263258 Map <String , NativeSql > nativeSqlBeans = context .getBeansOfType (NativeSql .class );
264- assertEquals (1 , nativeSqlBeans .size ());
265- assertNotNull (nativeSqlBeans .get ("myNativeSql" ));
259+ org .assertj .core .api .Assertions .assertThat (nativeSqlBeans .size ()).isEqualTo (1 );
260+ org .assertj .core .api .Assertions .assertThat (nativeSqlBeans .get ("myNativeSql" ))
261+ .isNotNull ();
266262 });
267263 }
268264
269265 @ Test
270- void testDialectByDataSourceUrl () {
266+ void dialectByDataSourceUrl () {
271267 this .contextRunner
272268 .withPropertyValues (
273269 "spring.datasource.url=jdbc:postgresql://localhost:1234/example" ,
@@ -279,7 +275,7 @@ void testDialectByDataSourceUrl() {
279275 }
280276
281277 @ Test
282- void testDialectByJdbConnectionDetails () {
278+ void dialectByJdbConnectionDetails () {
283279 this .contextRunner
284280 .withPropertyValues (
285281 "doma.exception-translation-enabled=false" /* prevent database connections */ )
@@ -306,20 +302,18 @@ public String getJdbcUrl() {
306302 }
307303
308304 @ Test
309- void testDialectMissingJdbConnectionDetails () {
305+ void dialectMissingJdbConnectionDetails () {
310306 this .contextRunner
311307 .withPropertyValues (
312308 "doma.exception-translation-enabled=false" /* prevent database connections */ )
313309
314310 .withBean (DataSource .class , SimpleDriverDataSource ::new )
315- .run (context -> {
316- assertThat (context .getStartupFailure ().getMessage (), containsString (
317- "No connection details available. You will probably have to set 'doma.dialect' explicitly." ));
318- });
311+ .run (context -> assertThat (context .getStartupFailure ().getMessage (), containsString (
312+ "No connection details available. You will probably have to set 'doma.dialect' explicitly." )));
319313 }
320314
321315 @ Test
322- void testDialectMissingJdbConnectionDetailsExplicitDialect () {
316+ void dialectMissingJdbConnectionDetailsExplicitDialect () {
323317 this .contextRunner
324318 .withPropertyValues (
325319 "doma.dialect=POSTGRES" ,
@@ -333,7 +327,7 @@ void testDialectMissingJdbConnectionDetailsExplicitDialect() {
333327 }
334328
335329 @ Test
336- void testDialectByDomaPropertiesIgnoreDataSourceUrl () {
330+ void dialectByDomaPropertiesIgnoreDataSourceUrl () {
337331 this .contextRunner
338332 .withPropertyValues (
339333 "spring.datasource.url=jdbc:h2:mem:example" ,
@@ -346,7 +340,7 @@ void testDialectByDomaPropertiesIgnoreDataSourceUrl() {
346340 }
347341
348342 @ Test
349- void testJdbcLoggerSlf4J () {
343+ void jdbcLoggerSlf4J () {
350344 this .contextRunner
351345 .withPropertyValues ("doma.jdbcLogger=SLF4J" )
352346
@@ -357,29 +351,30 @@ void testJdbcLoggerSlf4J() {
357351 }
358352
359353 @ Test
360- void testAutoRegisteredQueryDsl () {
354+ void autoRegisteredQueryDsl () {
361355 this .contextRunner
362356
363357 .run (context -> {
364358 QueryDsl queryDsl = context .getBean (QueryDsl .class );
365- assertNotNull (queryDsl );
359+ org . assertj . core . api . Assertions . assertThat (queryDsl ). isNotNull ( );
366360 });
367361 }
368362
369363 @ Test
370- void testQueryDslWithConfig () {
364+ void queryDslWithConfig () {
371365 this .contextRunner
372366 .withUserConfiguration (MyQueryDslConfig .class )
373367
374368 .run (context -> {
375369 Map <String , QueryDsl > queryDslBeans = context .getBeansOfType (QueryDsl .class );
376- assertEquals (1 , queryDslBeans .size ());
377- assertNotNull (queryDslBeans .get ("myQueryDsl" ));
370+ org .assertj .core .api .Assertions .assertThat (queryDslBeans .size ()).isEqualTo (1 );
371+ org .assertj .core .api .Assertions .assertThat (queryDslBeans .get ("myQueryDsl" ))
372+ .isNotNull ();
378373 });
379374 }
380375
381376 @ Test
382- void testThrowExceptionIfDuplicateColumn () {
377+ void throwExceptionIfDuplicateColumn () {
383378 this .contextRunner
384379 .withPropertyValues ("doma.throw-exception-if-duplicate-column=true" )
385380
@@ -391,7 +386,7 @@ void testThrowExceptionIfDuplicateColumn() {
391386 }
392387
393388 @ Test
394- void testCustomizeShouldRemoveBlockComment () {
389+ void customizeShouldRemoveBlockComment () {
395390 Predicate <String > predicate = mock (Predicate .class );
396391 when (predicate .test (anyString ())).thenReturn (true );
397392
@@ -411,7 +406,7 @@ void testCustomizeShouldRemoveBlockComment() {
411406 }
412407
413408 @ Test
414- void testCustomizeShouldRemoveLineComment () {
409+ void customizeShouldRemoveLineComment () {
415410 Predicate <String > predicate = mock (Predicate .class );
416411 when (predicate .test (anyString ())).thenReturn (true );
417412
@@ -431,7 +426,7 @@ void testCustomizeShouldRemoveLineComment() {
431426 }
432427
433428 @ Test
434- void testAnonymousPredicateAreNotAffected () {
429+ void anonymousPredicateAreNotAffected () {
435430 Predicate <String > predicate = mock (Predicate .class );
436431 when (predicate .test (anyString ())).thenReturn (true );
437432
@@ -450,65 +445,75 @@ void testAnonymousPredicateAreNotAffected() {
450445 }
451446
452447 @ Test
453- void testShouldRemoveBlankLinesDefaultValue () {
448+ void shouldRemoveBlankLinesDefaultValue () {
454449 this .contextRunner
455450
456451 .run (context -> {
457452 Config config = context .getBean (Config .class );
458- assertFalse (config .getSqlBuilderSettings ().shouldRemoveBlankLines ());
453+ org .assertj .core .api .Assertions
454+ .assertThat (config .getSqlBuilderSettings ().shouldRemoveBlankLines ())
455+ .isFalse ();
459456 });
460457 }
461458
462459 @ Test
463- void testShouldRemoveBlankLinesChangedValue () {
460+ void shouldRemoveBlankLinesChangedValue () {
464461 this .contextRunner
465462 .withPropertyValues ("doma.sql-builder-settings.should-remove-blank-lines=true" )
466463
467464 .run (context -> {
468465 Config config = context .getBean (Config .class );
469- assertTrue (config .getSqlBuilderSettings ().shouldRemoveBlankLines ());
466+ org .assertj .core .api .Assertions
467+ .assertThat (config .getSqlBuilderSettings ().shouldRemoveBlankLines ())
468+ .isTrue ();
470469 });
471470 }
472471
473472 @ Test
474- void testShouldRequireInListPaddingDefaultValue () {
473+ void shouldRequireInListPaddingDefaultValue () {
475474 this .contextRunner
476475
477476 .run (context -> {
478477 Config config = context .getBean (Config .class );
479- assertFalse (config .getSqlBuilderSettings ().shouldRequireInListPadding ());
478+ org .assertj .core .api .Assertions
479+ .assertThat (config .getSqlBuilderSettings ().shouldRequireInListPadding ())
480+ .isFalse ();
480481 });
481482 }
482483
483484 @ Test
484- void testShouldRequireInListPaddingChangedValue () {
485+ void shouldRequireInListPaddingChangedValue () {
485486 this .contextRunner
486487 .withPropertyValues ("doma.sql-builder-settings.should-require-in-list-padding=true" )
487488
488489 .run (context -> {
489490 Config config = context .getBean (Config .class );
490- assertTrue (config .getSqlBuilderSettings ().shouldRequireInListPadding ());
491+ org .assertj .core .api .Assertions
492+ .assertThat (config .getSqlBuilderSettings ().shouldRequireInListPadding ())
493+ .isTrue ();
491494 });
492495 }
493496
494497 @ Test
495- void testStatisticManagerDefaultValue () {
498+ void statisticManagerDefaultValue () {
496499 this .contextRunner
497500
498501 .run (context -> {
499502 Config config = context .getBean (Config .class );
500- assertFalse (config .getStatisticManager ().isEnabled ());
503+ org .assertj .core .api .Assertions
504+ .assertThat (config .getStatisticManager ().isEnabled ()).isFalse ();
501505 });
502506 }
503507
504508 @ Test
505- void testStatisticManagerChangedValue () {
509+ void statisticManagerChangedValue () {
506510 this .contextRunner
507511 .withPropertyValues ("doma.statistic-manager.enabled=true" )
508512
509513 .run (context -> {
510514 Config config = context .getBean (Config .class );
511- assertTrue (config .getStatisticManager ().isEnabled ());
515+ org .assertj .core .api .Assertions
516+ .assertThat (config .getStatisticManager ().isEnabled ()).isTrue ();
512517 });
513518 }
514519
0 commit comments