Class MicronautSpockExtension<T extends Annotation>
java.lang.Object
io.micronaut.test.extensions.AbstractMicronautExtension<org.spockframework.runtime.extension.IMethodInvocation>
io.micronaut.test.extensions.spock.MicronautSpockExtension<T>
- Type Parameters:
T- The MicronautTest annotation
- All Implemented Interfaces:
TestExecutionListener,TestMethodInterceptor<Object>,org.spockframework.runtime.extension.IAnnotationDrivenExtension<T>
public class MicronautSpockExtension<T extends Annotation>
extends AbstractMicronautExtension<org.spockframework.runtime.extension.IMethodInvocation>
implements org.spockframework.runtime.extension.IAnnotationDrivenExtension<T>
Extension for Spock.
- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from class io.micronaut.test.extensions.AbstractMicronautExtension
applicationContext, DISABLED_MESSAGE, embeddedApplication, MISCONFIGURED_MESSAGE, oldValues, refreshScope, specDefinition, TEST_PROPERTY_SOURCE, TEST_ROLLBACK, TEST_TRANSACTION_MODE, TEST_TRANSACTIONAL, testAnnotationValue, testProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidalignMocks(org.spockframework.runtime.extension.IMethodInvocation context, Object instance) protected voidresolveTestProperties(org.spockframework.runtime.extension.IMethodInvocation context, MicronautTestValue testAnnotationValue, Map<String, Object> testProperties) Resolves any test properties.protected voidStarts the application context.voidvisitFeatureAnnotation(T annotation, org.spockframework.runtime.model.FeatureInfo feature) voidvisitFieldAnnotation(T annotation, org.spockframework.runtime.model.FieldInfo field) voidvisitFixtureAnnotation(T annotation, org.spockframework.runtime.model.MethodInfo fixtureMethod) voidvisitSpec(org.spockframework.runtime.model.SpecInfo spec) voidvisitSpecAnnotation(T annotation, org.spockframework.runtime.model.SpecInfo spec) Methods inherited from class io.micronaut.test.extensions.AbstractMicronautExtension
afterClass, afterCleanupTest, afterEach, afterSetupTest, afterTestClass, afterTestExecution, afterTestMethod, beforeClass, beforeCleanupTest, beforeEach, beforeSetupTest, beforeTestClass, beforeTestExecution, beforeTestMethod, hasInterceptors, interceptAfterEach, interceptBeforeEach, interceptTest, isTestSuiteBeanPresent, postProcessBuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.spockframework.runtime.extension.IAnnotationDrivenExtension
visitFeatureAnnotations, visitFieldAnnotations, visitFixtureAnnotations, visitSpecAnnotations
-
Constructor Details
-
MicronautSpockExtension
public MicronautSpockExtension()
-
-
Method Details
-
visitSpecAnnotation
- Specified by:
visitSpecAnnotationin interfaceorg.spockframework.runtime.extension.IAnnotationDrivenExtension<T extends Annotation>
-
visitFeatureAnnotation
public void visitFeatureAnnotation(T annotation, org.spockframework.runtime.model.FeatureInfo feature) - Specified by:
visitFeatureAnnotationin interfaceorg.spockframework.runtime.extension.IAnnotationDrivenExtension<T extends Annotation>
-
visitFixtureAnnotation
public void visitFixtureAnnotation(T annotation, org.spockframework.runtime.model.MethodInfo fixtureMethod) - Specified by:
visitFixtureAnnotationin interfaceorg.spockframework.runtime.extension.IAnnotationDrivenExtension<T extends Annotation>
-
visitFieldAnnotation
- Specified by:
visitFieldAnnotationin interfaceorg.spockframework.runtime.extension.IAnnotationDrivenExtension<T extends Annotation>
-
visitSpec
public void visitSpec(org.spockframework.runtime.model.SpecInfo spec) - Specified by:
visitSpecin interfaceorg.spockframework.runtime.extension.IAnnotationDrivenExtension<T extends Annotation>
-
resolveTestProperties
protected void resolveTestProperties(org.spockframework.runtime.extension.IMethodInvocation context, MicronautTestValue testAnnotationValue, Map<String, Object> testProperties) Description copied from class:AbstractMicronautExtensionResolves any test properties.- Specified by:
resolveTestPropertiesin classAbstractMicronautExtension<org.spockframework.runtime.extension.IMethodInvocation>- Parameters:
context- The test contexttestAnnotationValue- The test annotationtestProperties- The test properties
-
startApplicationContext
protected void startApplicationContext()Description copied from class:AbstractMicronautExtensionStarts the application context.- Overrides:
startApplicationContextin classAbstractMicronautExtension<org.spockframework.runtime.extension.IMethodInvocation>
-
alignMocks
protected void alignMocks(org.spockframework.runtime.extension.IMethodInvocation context, Object instance) - Specified by:
alignMocksin classAbstractMicronautExtension<org.spockframework.runtime.extension.IMethodInvocation>- Parameters:
context- The contextinstance- The mock instance to inject
-