Annotation Type IgnoredClasses


@Retention(RUNTIME) @Target({TYPE,FIELD,METHOD}) public @interface IgnoredClasses
@IgnoredClasses prevent classes from being automatically added to the CDI environment.
 @RunWith(CdiRunner.class)
 @IgnoredClasses(Starship.class) //Starship is discoverable from the unit test but should not (it could be produced elsewhere).
 class TestStarship {

     @Inject
     Starship starship; //Starship has an engine.

     @Test
     void testStart() {
         starship.start(); // Going to warp!
     }
 }
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
    Class<?>[]
     
  • Element Details

    • value

      Class<?>[] value
      Returns:
      Array of classes to make undiscoverable during testing.
      Default:
      {}
    • late

      String[] late
      Returns:
      Array of class names to make undiscoverable during testing (late binding allows specifying classes that are package visible).
      Default:
      {}