Annotation Interface MockBean


@Retention(RUNTIME) @Target({METHOD,TYPE,ANNOTATION_TYPE,FIELD}) @Bean @Requires(condition=TestActiveCondition.class) @Refreshable("micronaut.test.spock.active.mocks") @Around(proxyTargetMode=ALLOW) public @interface MockBean
Annotation that can be applied on the method level in a test to define a Mock bean using Spock's mocking API.
Since:
1.0
Author:
graemerocher
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
    The name of the bean to replace in the case of multiple beans.
     
  • Element Details

    • value

      @AliasFor(annotation=io.micronaut.context.annotation.Replaces.class, member="value") Class<?> value
      Returns:
      The bean this mock replaces
      Default:
      void.class
    • bean

      @AliasFor(annotation=io.micronaut.context.annotation.Replaces.class, member="value") Class<?> bean
      Returns:
      The bean this mock replaces
      Default:
      void.class
    • named

      @AliasFor(annotation=io.micronaut.context.annotation.Replaces.class, member="named") String named
      The name of the bean to replace in the case of multiple beans.
      Returns:
      The qualifier
      Default:
      ""