diff --git a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionTest.java b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionTest.java index 1c05dd5b1ac..34754e18d7c 100644 --- a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionTest.java +++ b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionTest.java @@ -49,7 +49,7 @@ import software.amazon.awssdk.annotations.SdkProtectedApi; import software.amazon.awssdk.annotations.SdkPublicApi; -@AnalyzeClasses(packages = "software.amazon.awssdk..", +@AnalyzeClasses(packages = "software.amazon.awssdk", importOptions = ImportOption.DoNotIncludeTests.class) @ArchIgnore public class CodingConventionTest { diff --git a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionWithSuppressionTest.java b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionWithSuppressionTest.java index a117aaec855..0d132d85552 100644 --- a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionWithSuppressionTest.java +++ b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/CodingConventionWithSuppressionTest.java @@ -17,7 +17,6 @@ import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.methods; -import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noFields; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noMethods; import static com.tngtech.archunit.library.freeze.FreezingArchRule.freeze; @@ -37,7 +36,6 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; -import java.util.concurrent.Future; import java.util.regex.Pattern; import org.junit.jupiter.api.Test; import software.amazon.awssdk.annotations.SdkPublicApi; @@ -78,18 +76,7 @@ void publicApisShouldBeFinal() { .should().haveModifier(JavaModifier.FINAL)) .because("public APIs SHOULD be final") .check(classes); - } - - @Test - void shouldNotUseFuture() { - System.out.println("shouldNotUseFuture"); - JavaClasses classes = new ClassFileImporter() - .withImportOptions(Arrays.asList(new ImportOption.Predefined.DoNotIncludeTests())) - .importPackages("software.amazon.awssdk"); - freeze(noClasses().should().dependOnClassesThat().areAssignableFrom(Future.class) - .as("use java.util.concurrent.Future") - .because("Future SHOULD NOT be used, use CompletableFuture instead")) - .check(classes); + System.out.println("publicApisShouldBeFinal finished"); } @Test @@ -104,6 +91,7 @@ void shouldNotUseOptionalForFields() { + "https://github.com/aws/aws-sdk-java-v2/blob/master/docs" + "/design/UseOfOptional.md")) .check(classes); + System.out.println("shouldNotUseOptionalForFields finished"); } @Test @@ -117,6 +105,7 @@ void mustNotUseOptionalForMethodParam() { .because("Optional MUST NOT be used for method parameters. See " + "https://github.com/aws/aws-sdk-java-v2/blob/master/docs/design/UseOfOptional.md")) .check(classes); + System.out.println("mustNotUseOptionalForMethodParam finished"); } @Test @@ -125,12 +114,13 @@ void publicApisMustNotDeclareThrowableOfCheckedException() { JavaClasses classes = new ClassFileImporter() .withImportOptions(Arrays.asList(new ImportOption.Predefined.DoNotIncludeTests())) .importPackages("software.amazon.awssdk"); - freeze(noMethods().that() + freeze(noMethods().that().arePublic().and() .areDeclaredInClassesThat().areAnnotatedWith(SdkPublicApi.class) .should() .declareThrowableOfType(Exception.class).orShould().declareThrowableOfType(IOException.class) .because("public APIs MUST NOT throw checked exception")) .check(classes); + System.out.println("publicApisMustNotDeclareThrowableOfCheckedException finished"); } @Test @@ -140,7 +130,7 @@ void shouldNotAbuseWarnLog() { .withImportOptions(Arrays.asList( location -> ALLOWED_WARN_LOG_SUPPRESSION.stream().noneMatch(location::matches), new ImportOption.Predefined.DoNotIncludeTests())) - .importPackages("software.amazon.awssdk.."); + .importPackages("software.amazon.awssdk"); ArchRule rule = freeze(methods().that().areDeclaredIn(Logger.class).and() @@ -150,6 +140,7 @@ void shouldNotAbuseWarnLog() { + " to ALLOWED_WARN_LOG_SUPPRESSION allowlist"); rule.check(classes); + System.out.println("shouldNotAbuseWarnLog finished"); } @Test @@ -159,7 +150,7 @@ void shouldNotAbuseErrorLog() { .withImportOptions(Arrays.asList( location -> ALLOWED_ERROR_LOG_SUPPRESSION.stream().noneMatch(location::matches), new ImportOption.Predefined.DoNotIncludeTests())) - .importPackages("software.amazon.awssdk.."); + .importPackages("software.amazon.awssdk"); ArchRule rule = freeze(methods().that().areDeclaredIn(Logger.class).and() @@ -168,6 +159,7 @@ void shouldNotAbuseErrorLog() { + "ALLOWED_ERROR_LOG_SUPPRESSION allowlist"); rule.check(classes); + System.out.println("shouldNotAbuseErrorLog finished"); } private static final class MethodBeingUsedByOthers extends ArchCondition { diff --git a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionTest.java b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionTest.java index 65460c2cd7b..0d9e4e26ac7 100644 --- a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionTest.java +++ b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionTest.java @@ -22,14 +22,9 @@ import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.lang.ArchRule; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; -import java.util.regex.Pattern; import software.amazon.awssdk.awscore.presigner.SdkPresigner; -@AnalyzeClasses(packages = "software.amazon.awssdk..") +@AnalyzeClasses(packages = "software.amazon.awssdk") public class NamingConventionTest { @ArchTest diff --git a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java index 75277418c19..e9299103d11 100644 --- a/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java +++ b/test/architecture-tests/src/test/java/software/amazon/awssdk/archtests/NamingConventionWithSuppressionTest.java @@ -54,7 +54,7 @@ void supplierImpl_shouldHaveSupplierSuffix() { .withImportOptions(Arrays.asList( location -> ALLOWED_SUPPLIER_SUPPRESSION.stream().noneMatch(location::matches), new ImportOption.Predefined.DoNotIncludeTests())) - .importPackages("software.amazon.awssdk.."); + .importPackages("software.amazon.awssdk"); ArchRule rule = classes().that().implement(Supplier.class).and().areNotPackagePrivate().should().haveSimpleNameEndingWith(