Package org.jboss.weld.junit5.auto
Annotation Type ExcludeBeanClasses
-
@Retention(RUNTIME) @Target(TYPE) @Inherited @Repeatable(All.class) public @interface ExcludeBeanClasses
ExcludeBeanClasses
excludes a set of classes with bean defining annotations (e.g. scopes) from automatic discovery. This can be helpful to allow replacing bean classes with a different implementation; typically a mock. This annotation works as an inverse ofAddBeanClasses
hence usually requires actual bean implementation classes as parameters. NOTE: This annotation will only exclude beans defined by class annotations. It will not exclude beans of the specified type that are defined byProduces
producer methods/fields or synthetic beans. Example:@EnableAutoWeld @ExcludeBeanClasses(Foo.class) // Excludes Foo bean class from automatic discovery class TestSomeFoo { @Inject SomeFoo someFoo; // SomeFoo depends upon application scoped bean Foo @Produces Foo mockFoo = mock(Foo.class); // mockFoo is now produced in place of original Foo impl @Test void test(Foo myFoo) { assertNotNull(myFoo); assertEquals(myFoo.getBar(), "mock-foo"); } }
- See Also:
ExcludeBean
-
-
Element Detail
-
value
Class<?>[] value
-
-