diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/cdi/CdiInjectionTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/cdi/CdiInjectionTest.java index 5770015fc..4d3e8e369 100644 --- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/cdi/CdiInjectionTest.java +++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/cdi/CdiInjectionTest.java @@ -25,19 +25,18 @@ import jakarta.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.integration.test.common.app.Greeter; -import org.jboss.arquillian.junit5.ArquillianExtension; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; /** * @author James R. Perkins */ -@ExtendWith(ArquillianExtension.class) +@ArquillianTest @ApplicationScoped public class CdiInjectionTest { diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/lifecycle/LifecycleMethodsTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/lifecycle/LifecycleMethodsTest.java index f9d28fe97..8426f603a 100644 --- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/lifecycle/LifecycleMethodsTest.java +++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/lifecycle/LifecycleMethodsTest.java @@ -17,13 +17,14 @@ import jakarta.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit5.ArquillianExtension; import static org.jboss.arquillian.integration.test.lifecycle.FileWriterExtension.RunsWhere.CLIENT; import static org.jboss.arquillian.integration.test.lifecycle.FileWriterExtension.RunsWhere.SERVER; import static org.jboss.arquillian.integration.test.lifecycle.FileWriterExtension.TMP_FILE_ASSET_NAME; import static org.jboss.arquillian.integration.test.lifecycle.FileWriterExtension.appendToFile; import static org.jboss.arquillian.integration.test.lifecycle.FileWriterExtension.checkRunsWhere; import static org.jboss.arquillian.integration.test.lifecycle.FileWriterExtension.getTmpFilePath; + +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; @@ -41,7 +42,7 @@ * @author lprimak */ @ExtendWith(FileWriterExtension.class) -@ExtendWith(ArquillianExtension.class) +@ArquillianTest public class LifecycleMethodsTest { @Inject Greeter greeter; diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/manual/ManualModeTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/manual/ManualModeTest.java index 83a59f0b8..8ce79ffad 100644 --- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/manual/ManualModeTest.java +++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/manual/ManualModeTest.java @@ -30,7 +30,7 @@ import org.jboss.arquillian.integration.test.common.TestEnvironment; import org.jboss.arquillian.integration.test.common.app.EchoResource; import org.jboss.arquillian.integration.test.common.app.RestActivator; -import org.jboss.arquillian.junit5.ArquillianExtension; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; @@ -39,12 +39,11 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; /** * @author James R. Perkins */ -@ExtendWith(ArquillianExtension.class) +@ArquillianTest @RunAsClient public class ManualModeTest { private static final String CONTAINER_NAME = "default"; diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java index a02cbfd5f..cea30682e 100644 --- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java +++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java @@ -25,19 +25,18 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.integration.test.common.TestEnvironment; import org.jboss.arquillian.integration.test.common.app.Greeter; -import org.jboss.arquillian.junit5.ArquillianExtension; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; /** * @author James R. Perkins */ -@ExtendWith(ArquillianExtension.class) +@ArquillianTest abstract class AbstractArquillianResourceTest { static final String DEPLOYMENT_NAME = "injection"; diff --git a/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/annotation/ArquillianTest.java b/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/annotation/ArquillianTest.java new file mode 100644 index 000000000..0efdeb489 --- /dev/null +++ b/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/annotation/ArquillianTest.java @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2024 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jboss.arquillian.junit5.container.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.jboss.arquillian.junit5.ArquillianExtension; +import org.junit.jupiter.api.extension.ExtendWith; + +/** + * Indicates this is an Arquillian test. This is short for {@link ExtendWith @ExtendWith(ArquillianExtension.class)}. + * + * @author James R. Perkins + */ +@Inherited +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@ExtendWith(ArquillianExtension.class) +public @interface ArquillianTest { +}