33import org .jspecify .annotations .NullMarked ;
44import org .junit .jupiter .api .Test ;
55
6- import java .util .List ;
76import java .util .Map ;
87
9- import static org .junit .jupiter .api .Assertions .assertEquals ;
10- import static org .junit .jupiter .api .Assertions .assertTrue ;
8+ import static org .assertj .core .api .Assertions .assertThat ;
119
1210@ NullMarked
1311class JSpecifyMapStructMapperAnnotationCheckTest extends CheckTestSupport {
@@ -16,98 +14,86 @@ class JSpecifyMapStructMapperAnnotationCheckTest extends CheckTestSupport {
1614
1715 @ Test
1816 void wellOrderedMapperPasses () throws Exception {
19- assertEquals ( List . of (), runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodMapper.java" ));
17+ assertThat ( runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodMapper.java" )). isEmpty ( );
2018 }
2119
2220 @ Test
2321 void mapperWithNamedValueArgumentPasses () throws Exception {
24- assertEquals (
25- List .of (),
26- runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodMapperNamedValue.java" )
27- );
22+ assertThat (runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodMapperNamedValue.java" )).isEmpty ();
2823 }
2924
3025 @ Test
3126 void swappedOrderFails () throws Exception {
3227 var v = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "BadOrderSwapped.java" );
33- assertEquals ( 1 , v . size () );
34- assertTrue (v .getFirst ().contains ("BadOrderSwapped" ), v . toString () );
28+ assertThat ( v ). hasSize ( 1 );
29+ assertThat (v .getFirst ()) .contains ("BadOrderSwapped" );
3530 }
3631
3732 @ Test
3833 void missingAnnotateWithFails () throws Exception {
3934 var v = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "BadMissingAnnotateWith.java" );
40- assertEquals ( 1 , v . size () );
35+ assertThat ( v ). hasSize ( 1 );
4136 }
4237
4338 @ Test
4439 void annotateWithWrongClassLiteralFails () throws Exception {
4540 var v = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "BadWrongClassLiteral.java" );
46- assertEquals ( 1 , v . size () );
41+ assertThat ( v ). hasSize ( 1 );
4742 }
4843
4944 @ Test
5045 void interfaceWithoutMapperIsIgnored () throws Exception {
51- assertEquals (
52- List .of (),
53- runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "NonMapperInterfaceIgnored.java" )
54- );
46+ assertThat (runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "NonMapperInterfaceIgnored.java" )).isEmpty ();
5547 }
5648
5749 @ Test
5850 void customMapperAnnotationNameIsHonored () throws Exception {
5951 var properties = Map .of ("mapperAnnotationName" , "MyMapper" );
6052
6153 var ok = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "CustomMapperGood.java" , properties );
62- assertEquals ( List . of (), ok );
54+ assertThat ( ok ). isEmpty ( );
6355
6456 var bad = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "CustomMapperBad.java" , properties );
65- assertEquals ( 1 , bad . size () );
66- assertTrue (bad .getFirst ().contains ("CustomMapperBad" ), bad . toString () );
57+ assertThat ( bad ). hasSize ( 1 );
58+ assertThat (bad .getFirst ()) .contains ("CustomMapperBad" );
6759 }
6860
6961 @ Test
7062 void customAnnotateWithAnnotationNameIsHonored () throws Exception {
7163 var properties = Map .of ("annotateWithAnnotationName" , "MyAnnotateWith" );
7264
7365 var ok = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "CustomAnnotateWithGood.java" , properties );
74- assertEquals ( List . of (), ok );
66+ assertThat ( ok ). isEmpty ( );
7567
7668 var bad = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodMapper.java" , properties );
77- assertEquals ( 1 , bad . size (), bad . toString () );
69+ assertThat ( bad ). hasSize ( 1 );
7870 }
7971
8072 @ Test
8173 void customNullUnmarkedAnnotationNameIsHonored () throws Exception {
8274 var properties = Map .of ("nullUnmarkedAnnotationName" , "MyUnmarked" );
8375
8476 var ok = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "CustomNullUnmarkedGood.java" , properties );
85- assertEquals ( List . of (), ok );
77+ assertThat ( ok ). isEmpty ( );
8678
8779 var bad = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodMapper.java" , properties );
88- assertEquals ( 1 , bad . size (), bad . toString () );
80+ assertThat ( bad ). hasSize ( 1 );
8981 }
9082
9183 @ Test
9284 void wellOrderedAbstractClassMapperPasses () throws Exception {
93- assertEquals (
94- List .of (),
95- runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodAbstractMapper.java" )
96- );
85+ assertThat (runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "GoodAbstractMapper.java" )).isEmpty ();
9786 }
9887
9988 @ Test
10089 void abstractClassMapperWithSwappedOrderFails () throws Exception {
10190 var v = runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "BadAbstractMapperOrderSwapped.java" );
102- assertEquals ( 1 , v . size () );
103- assertTrue (v .getFirst ().contains ("BadAbstractMapperOrderSwapped" ), v . toString () );
91+ assertThat ( v ). hasSize ( 1 );
92+ assertThat (v .getFirst ()) .contains ("BadAbstractMapperOrderSwapped" );
10493 }
10594
10695 @ Test
10796 void nonAbstractClassWithMapperAnnotationIsIgnored () throws Exception {
108- assertEquals (
109- List .of (),
110- runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "NonAbstractClassWithMapperAnnotationIgnored.java" )
111- );
97+ assertThat (runCheck (JSpecifyMapStructMapperAnnotationCheck .class , BASE + "NonAbstractClassWithMapperAnnotationIgnored.java" )).isEmpty ();
11298 }
11399}
0 commit comments