diff --git a/junit-common/src/test/java/eu/coldrye/junit/util/Fixtures.java b/junit-common/src/test/java/eu/coldrye/junit/util/Fixtures.java index 085b221..5a0516e 100644 --- a/junit-common/src/test/java/eu/coldrye/junit/util/Fixtures.java +++ b/junit-common/src/test/java/eu/coldrye/junit/util/Fixtures.java @@ -22,12 +22,16 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -public interface Fixtures { +public class Fixtures { + + private Fixtures() { + + } @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented - @interface Provided { + public @interface Provided { } @@ -35,7 +39,7 @@ public interface Fixtures { @Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented - @interface CustomProvided { + public @interface CustomProvided { } @@ -43,28 +47,28 @@ public interface Fixtures { @Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented - @interface CustomProvided2 { + public @interface CustomProvided2 { } - class Custom1 { + @CustomProvided + public interface Iface1 { } - class Custom2 { + public interface DerivedIface extends Iface1 { } - @CustomProvided - interface Iface1 { + public static class Custom1 { } - interface DerivedIface extends Iface1 { + public static class Custom2 { } - abstract class TestCaseBase { + public static abstract class TestCaseBase { @CustomProvided Custom1 custom1; @@ -78,12 +82,12 @@ public void setCustom2(@CustomProvided Custom2 custom2) { } @Provided - class FirstTestCase implements DerivedIface { + public static class FirstTestCase implements DerivedIface { } @CustomProvided - class SecondTestCase extends TestCaseBase { + public static class SecondTestCase extends TestCaseBase { @Provided Custom1 custom; @@ -94,8 +98,7 @@ public void setCustom1(@CustomProvided Custom1 custom) { } } - class ThirdTestCase { + public static class ThirdTestCase { } - } diff --git a/junit-env-extension/src/main/java/eu/coldrye/junit/env/ParameterResolverImpl.java b/junit-env-extension/src/main/java/eu/coldrye/junit/env/DefaultParameterResolver.java similarity index 96% rename from junit-env-extension/src/main/java/eu/coldrye/junit/env/ParameterResolverImpl.java rename to junit-env-extension/src/main/java/eu/coldrye/junit/env/DefaultParameterResolver.java index 87249b2..58662af 100644 --- a/junit-env-extension/src/main/java/eu/coldrye/junit/env/ParameterResolverImpl.java +++ b/junit-env-extension/src/main/java/eu/coldrye/junit/env/DefaultParameterResolver.java @@ -26,13 +26,13 @@ import java.util.List; /** - * The final class ParameterResolverImpl models a resolver for parameters. + * The final class DefaultParameterResolver models a resolver for parameters. *

* It does so by querying available {@link EnvProvider}S. * * @since 1.0.0 */ -class ParameterResolverImpl { +class DefaultParameterResolver { /** * @param parameterContext diff --git a/junit-env-extension/src/main/java/eu/coldrye/junit/env/TestExecutionListenerImpl.java b/junit-env-extension/src/main/java/eu/coldrye/junit/env/DefaultTestExecutionListener.java similarity index 84% rename from junit-env-extension/src/main/java/eu/coldrye/junit/env/TestExecutionListenerImpl.java rename to junit-env-extension/src/main/java/eu/coldrye/junit/env/DefaultTestExecutionListener.java index 26f7e4d..693570d 100644 --- a/junit-env-extension/src/main/java/eu/coldrye/junit/env/TestExecutionListenerImpl.java +++ b/junit-env-extension/src/main/java/eu/coldrye/junit/env/DefaultTestExecutionListener.java @@ -21,16 +21,16 @@ import org.junit.platform.launcher.TestPlan; /** - * The final class TestExecutionListenerImpl provides a means to be able to shut down + * The final class DefaultTestExecutionListener provides a means to be able to shut down * existing environments after that all tests have been run. *

* It gets registered via {@code META-INF/services/org.junit.platform.launcher.TestExecutionListener}. *

- * This class is internal and must not be used directly. + * NOTE: This class is internal and must not be used directly. * * @since 1.0.0 */ -public final class TestExecutionListenerImpl implements TestExecutionListener { +public final class DefaultTestExecutionListener implements TestExecutionListener { @Override public void testPlanExecutionFinished(TestPlan testPlan) { diff --git a/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvExtension.java b/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvExtension.java index d370928..ae94260 100644 --- a/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvExtension.java +++ b/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvExtension.java @@ -40,7 +40,7 @@ public final class EnvExtension implements TestInstancePostProcessor, ParameterR private final FieldInjector fieldInjector; - private final ParameterResolverImpl parameterResolver; + private final DefaultParameterResolver parameterResolver; /** * Default constructor @@ -48,7 +48,7 @@ public final class EnvExtension implements TestInstancePostProcessor, ParameterR //NOSONAR public EnvExtension() { - this(EnvProviderManager.getInstance(), new FieldInjector(), new ParameterResolverImpl()); + this(EnvProviderManager.getInstance(), new FieldInjector(), new DefaultParameterResolver()); } /** @@ -58,7 +58,7 @@ public EnvExtension() { */ // For testing only EnvExtension(EnvProviderManager providerManager, FieldInjector fieldInjector, - ParameterResolverImpl parameterResolver) { + DefaultParameterResolver parameterResolver) { Preconditions.notNull(providerManager, "providerManager must not be null"); Preconditions.notNull(fieldInjector, "fieldInjector must not be null"); diff --git a/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvProviderManager.java b/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvProviderManager.java index 3fdda48..f1a2b46 100644 --- a/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvProviderManager.java +++ b/junit-env-extension/src/main/java/eu/coldrye/junit/env/EnvProviderManager.java @@ -76,7 +76,7 @@ static synchronized EnvProviderManager getInstance() { } /** - * Destroys the instance. Called by {@link TestExecutionListenerImpl#testPlanExecutionFinished(TestPlan)} at the end + * Destroys the instance. Called by {@link DefaultTestExecutionListener#testPlanExecutionFinished(TestPlan)} at the end * of the test execution. */ static void destroyInstance() { diff --git a/junit-env-extension/src/main/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener b/junit-env-extension/src/main/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener index 2fb3b42..817995a 100644 --- a/junit-env-extension/src/main/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener +++ b/junit-env-extension/src/main/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener @@ -1 +1 @@ -eu.coldrye.junit.env.TestExecutionListenerImpl +eu.coldrye.junit.env.DefaultTestExecutionListener diff --git a/junit-env-extension/src/test/java/eu/coldrye/junit/env/ParameterResolverImplTest.java b/junit-env-extension/src/test/java/eu/coldrye/junit/env/DefaultParameterResolverTest.java similarity index 97% rename from junit-env-extension/src/test/java/eu/coldrye/junit/env/ParameterResolverImplTest.java rename to junit-env-extension/src/test/java/eu/coldrye/junit/env/DefaultParameterResolverTest.java index 9b1a71b..6bdd163 100644 --- a/junit-env-extension/src/test/java/eu/coldrye/junit/env/ParameterResolverImplTest.java +++ b/junit-env-extension/src/test/java/eu/coldrye/junit/env/DefaultParameterResolverTest.java @@ -33,16 +33,16 @@ import java.util.Arrays; import java.util.List; -public class ParameterResolverImplTest { +public class DefaultParameterResolverTest { - private ParameterResolverImpl sut; + private DefaultParameterResolver sut; private List providers; @BeforeEach public void setUp() { - sut = new ParameterResolverImpl(); + sut = new DefaultParameterResolver(); providers = Arrays.asList(new EnvProvider[]{ new EnvProvider1(), new EnvProvider2() }); diff --git a/junit-env-extension/src/test/java/eu/coldrye/junit/env/TestExecutionListenerImplTest.java b/junit-env-extension/src/test/java/eu/coldrye/junit/env/DefaultTestExecutionListenerTest.java similarity index 87% rename from junit-env-extension/src/test/java/eu/coldrye/junit/env/TestExecutionListenerImplTest.java rename to junit-env-extension/src/test/java/eu/coldrye/junit/env/DefaultTestExecutionListenerTest.java index 037cc6a..bc17db8 100644 --- a/junit-env-extension/src/test/java/eu/coldrye/junit/env/TestExecutionListenerImplTest.java +++ b/junit-env-extension/src/test/java/eu/coldrye/junit/env/DefaultTestExecutionListenerTest.java @@ -23,7 +23,7 @@ import java.util.Collections; -public class TestExecutionListenerImplTest { +public class DefaultTestExecutionListenerTest { @Test public void testPlanExecutionFinishedMustInstructManagerToShutdown() { @@ -31,7 +31,7 @@ public void testPlanExecutionFinishedMustInstructManagerToShutdown() { EnvProviderManager mockManager = Mockito.mock(EnvProviderManager.class); EnvProviderManager.INSTANCE.set(mockManager); TestPlan testPlan = TestPlan.from(Collections.emptyList()); - new TestExecutionListenerImpl().testPlanExecutionFinished(testPlan); + new DefaultTestExecutionListener().testPlanExecutionFinished(testPlan); Mockito.verify(mockManager).shutdown(); Assertions.assertNull(EnvProviderManager.INSTANCE.get()); } @@ -41,6 +41,6 @@ public void testPlanExecutionFinishedMustNotFailOnMissingManagerInstance() { TestPlan testPlan = TestPlan.from(Collections.emptyList()); EnvProviderManager.destroyInstance(); - new TestExecutionListenerImpl().testPlanExecutionFinished(testPlan); + new DefaultTestExecutionListener().testPlanExecutionFinished(testPlan); } } diff --git a/junit-env-extension/src/test/java/eu/coldrye/junit/env/EnvExtensionTest.java b/junit-env-extension/src/test/java/eu/coldrye/junit/env/EnvExtensionTest.java index a04e4c6..2a4f34f 100644 --- a/junit-env-extension/src/test/java/eu/coldrye/junit/env/EnvExtensionTest.java +++ b/junit-env-extension/src/test/java/eu/coldrye/junit/env/EnvExtensionTest.java @@ -37,7 +37,7 @@ public class EnvExtensionTest { protected FieldInjector mockInjector; - protected ParameterResolverImpl mockResolver; + protected DefaultParameterResolver mockResolver; protected ExtensionContext mockContext; @@ -46,7 +46,7 @@ public class EnvExtensionTest { @BeforeEach public void setUp() { - mockResolver = Mockito.mock(ParameterResolverImpl.class); + mockResolver = Mockito.mock(DefaultParameterResolver.class); mockInjector = Mockito.mock(FieldInjector.class); mockManager = Mockito.mock(EnvProviderManager.class); mockContext = JunitExtensionTestUtils.createExtensionContextMock(FirstTestCase.class, Mockito.mock(Store.class)); diff --git a/junit-env-extension/src/test/java/eu/coldrye/junit/env/Fixtures.java b/junit-env-extension/src/test/java/eu/coldrye/junit/env/Fixtures.java index f82f68c..ba43e29 100644 --- a/junit-env-extension/src/test/java/eu/coldrye/junit/env/Fixtures.java +++ b/junit-env-extension/src/test/java/eu/coldrye/junit/env/Fixtures.java @@ -25,7 +25,11 @@ import java.lang.annotation.Target; import java.lang.reflect.AnnotatedElement; -public interface Fixtures { +public class Fixtures { + + private Fixtures() { + + } @Environment(EnvProvider2.class) interface AnotherEnvProvidingInterface extends SomethingInBetween { @@ -60,20 +64,20 @@ interface EnvProvidingInterface { } - interface SomethingInBetween extends EnvProvidingInterface { + public interface SomethingInBetween extends EnvProvidingInterface { } - class EnvProvider1ProvidedBoundaryInterface { + public static class EnvProvider1ProvidedBoundaryInterface { } - class EnvProvider2ProvidedBoundaryInterface { + public static class EnvProvider2ProvidedBoundaryInterface { } @Environment(EnvProvider1.class) - abstract class AbstractTestCaseBase { + public static abstract class AbstractTestCaseBase { @EnvProvider1Provided public EnvProvider1ProvidedBoundaryInterface service; @@ -92,7 +96,7 @@ public void setService(EnvProvider1ProvidedBoundaryInterface service) { } } - abstract class AbstractTestEnvProvider extends AbstractEnvProvider { + public static abstract class AbstractTestEnvProvider extends AbstractEnvProvider { @Override public boolean canProvideInstance(AnnotatedElement annotated, Class classOrInterface) { @@ -117,7 +121,7 @@ public void tearDownEnvironment(EnvPhase phase, AnnotatedElement annotated) thro } } - class EnvProvider1 extends AbstractTestEnvProvider { + public static class EnvProvider1 extends AbstractTestEnvProvider { @Override public boolean canProvideInstance(AnnotatedElement annotated, Class classOrInterface) { @@ -133,7 +137,7 @@ public Object getOrCreateInstance(AnnotatedElement annotated, Class classOrIn } } - class EnvProvider2 extends AbstractTestEnvProvider { + public static class EnvProvider2 extends AbstractTestEnvProvider { @Override public boolean canProvideInstance(AnnotatedElement annotated, Class classOrInterface) { @@ -149,27 +153,27 @@ public Object getOrCreateInstance(AnnotatedElement annotated, Class classOrIn } } - class EnvProvider3 extends AbstractTestEnvProvider { + public static class EnvProvider3 extends AbstractTestEnvProvider { } - class EnvProvider4 extends AbstractTestEnvProvider { + public static class EnvProvider4 extends AbstractTestEnvProvider { } - class EnvProvider5 extends AbstractTestEnvProvider { + public static class EnvProvider5 extends AbstractTestEnvProvider { } @Environment(EnvProvider3.class) - class FirstTestCase extends AbstractTestCaseBase implements EnvProvidingInterface { + public static class FirstTestCase extends AbstractTestCaseBase implements EnvProvidingInterface { } @Environment(EnvProvider2.class) @Environment(EnvProvider4.class) @Environment(EnvProvider5.class) - class SecondTestCase extends AbstractTestCaseBase implements AnotherEnvProvidingInterface { + public static class SecondTestCase extends AbstractTestCaseBase implements AnotherEnvProvidingInterface { @EnvProvider2Provided public EnvProvider2ProvidedBoundaryInterface service2; @@ -205,21 +209,21 @@ public void testing4(@NotEnvProvided Object notEnvProvided) { } } - class ThirdTestCase { + public static class ThirdTestCase { } @Environment(AbstractTestEnvProvider.class) - class FourthTestCase { + public static class FourthTestCase { } @Environment(EnvProvider.class) - class FifthTestCase { + public static class FifthTestCase { } - class SimpleEnvProvider extends AbstractEnvProvider { + public static class SimpleEnvProvider extends AbstractEnvProvider { @Override public boolean canProvideInstance(AnnotatedElement annotated, Class classOrInterface) { diff --git a/junit-env-extension/src/test/java/eu/coldrye/junit/env/integration/Fixtures.java b/junit-env-extension/src/test/java/eu/coldrye/junit/env/integration/Fixtures.java index 524347e..288f0c1 100644 --- a/junit-env-extension/src/test/java/eu/coldrye/junit/env/integration/Fixtures.java +++ b/junit-env-extension/src/test/java/eu/coldrye/junit/env/integration/Fixtures.java @@ -20,14 +20,20 @@ import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; -public interface Fixtures { +public class Fixtures { + + private Fixtures() { + + } @Configuration @ComponentScan("eu.coldrye.junit.env") - class TestConfig { + public static class TestConfig { } @Component - class SimpleComponent {} + public static class SimpleComponent { + + } }