17
17
18
18
import static com .tngtech .archunit .lang .syntax .ArchRuleDefinition .classes ;
19
19
import static com .tngtech .archunit .lang .syntax .ArchRuleDefinition .methods ;
20
- import static com .tngtech .archunit .lang .syntax .ArchRuleDefinition .noClasses ;
21
20
import static com .tngtech .archunit .lang .syntax .ArchRuleDefinition .noFields ;
22
21
import static com .tngtech .archunit .lang .syntax .ArchRuleDefinition .noMethods ;
23
22
import static com .tngtech .archunit .library .freeze .FreezingArchRule .freeze ;
37
36
import java .util .HashSet ;
38
37
import java .util .Optional ;
39
38
import java .util .Set ;
40
- import java .util .concurrent .Future ;
41
39
import java .util .regex .Pattern ;
42
40
import org .junit .jupiter .api .Test ;
43
41
import software .amazon .awssdk .annotations .SdkPublicApi ;
@@ -78,18 +76,7 @@ void publicApisShouldBeFinal() {
78
76
.should ().haveModifier (JavaModifier .FINAL ))
79
77
.because ("public APIs SHOULD be final" )
80
78
.check (classes );
81
- }
82
-
83
- @ Test
84
- void shouldNotUseFuture () {
85
- System .out .println ("shouldNotUseFuture" );
86
- JavaClasses classes = new ClassFileImporter ()
87
- .withImportOptions (Arrays .asList (new ImportOption .Predefined .DoNotIncludeTests ()))
88
- .importPackages ("software.amazon.awssdk" );
89
- freeze (noClasses ().should ().dependOnClassesThat ().areAssignableFrom (Future .class )
90
- .as ("use java.util.concurrent.Future" )
91
- .because ("Future SHOULD NOT be used, use CompletableFuture instead" ))
92
- .check (classes );
79
+ System .out .println ("publicApisShouldBeFinal finished" );
93
80
}
94
81
95
82
@ Test
@@ -104,6 +91,7 @@ void shouldNotUseOptionalForFields() {
104
91
+ "https://github.com/aws/aws-sdk-java-v2/blob/master/docs"
105
92
+ "/design/UseOfOptional.md" ))
106
93
.check (classes );
94
+ System .out .println ("shouldNotUseOptionalForFields finished" );
107
95
}
108
96
109
97
@ Test
@@ -117,6 +105,7 @@ void mustNotUseOptionalForMethodParam() {
117
105
.because ("Optional MUST NOT be used for method parameters. See "
118
106
+ "https://github.com/aws/aws-sdk-java-v2/blob/master/docs/design/UseOfOptional.md" ))
119
107
.check (classes );
108
+ System .out .println ("mustNotUseOptionalForMethodParam finished" );
120
109
}
121
110
122
111
@ Test
@@ -125,12 +114,13 @@ void publicApisMustNotDeclareThrowableOfCheckedException() {
125
114
JavaClasses classes = new ClassFileImporter ()
126
115
.withImportOptions (Arrays .asList (new ImportOption .Predefined .DoNotIncludeTests ()))
127
116
.importPackages ("software.amazon.awssdk" );
128
- freeze (noMethods ().that ()
117
+ freeze (noMethods ().that (). arePublic (). and ()
129
118
.areDeclaredInClassesThat ().areAnnotatedWith (SdkPublicApi .class )
130
119
.should ()
131
120
.declareThrowableOfType (Exception .class ).orShould ().declareThrowableOfType (IOException .class )
132
121
.because ("public APIs MUST NOT throw checked exception" ))
133
122
.check (classes );
123
+ System .out .println ("publicApisMustNotDeclareThrowableOfCheckedException finished" );
134
124
}
135
125
136
126
@ Test
@@ -140,7 +130,7 @@ void shouldNotAbuseWarnLog() {
140
130
.withImportOptions (Arrays .asList (
141
131
location -> ALLOWED_WARN_LOG_SUPPRESSION .stream ().noneMatch (location ::matches ),
142
132
new ImportOption .Predefined .DoNotIncludeTests ()))
143
- .importPackages ("software.amazon.awssdk.. " );
133
+ .importPackages ("software.amazon.awssdk" );
144
134
145
135
ArchRule rule =
146
136
freeze (methods ().that ().areDeclaredIn (Logger .class ).and ()
@@ -150,6 +140,7 @@ void shouldNotAbuseWarnLog() {
150
140
+ " to ALLOWED_WARN_LOG_SUPPRESSION allowlist" );
151
141
152
142
rule .check (classes );
143
+ System .out .println ("shouldNotAbuseWarnLog finished" );
153
144
}
154
145
155
146
@ Test
@@ -159,7 +150,7 @@ void shouldNotAbuseErrorLog() {
159
150
.withImportOptions (Arrays .asList (
160
151
location -> ALLOWED_ERROR_LOG_SUPPRESSION .stream ().noneMatch (location ::matches ),
161
152
new ImportOption .Predefined .DoNotIncludeTests ()))
162
- .importPackages ("software.amazon.awssdk.. " );
153
+ .importPackages ("software.amazon.awssdk" );
163
154
164
155
ArchRule rule =
165
156
freeze (methods ().that ().areDeclaredIn (Logger .class ).and ()
@@ -168,6 +159,7 @@ void shouldNotAbuseErrorLog() {
168
159
+ "ALLOWED_ERROR_LOG_SUPPRESSION allowlist" );
169
160
170
161
rule .check (classes );
162
+ System .out .println ("shouldNotAbuseErrorLog finished" );
171
163
}
172
164
173
165
private static final class MethodBeingUsedByOthers extends ArchCondition <JavaMethod > {
0 commit comments