Annotation Type AdditionalClasses


@Retention(RUNTIME) @Target(TYPE) public @interface AdditionalClasses
@AdditionalClasses adds classes to the CDI environment that are not discovered automatically.
 @RunWith(CdiRunner.class)
 @AdditionalClasses(WarpDrive.class) //WarpDrive is not discoverable from the unit test so explicitly make it available.
 class TestStarship {

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

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

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

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
  • Element Details

    • value

      Class<?>[] value
      Returns:
      Array of classes to make discoverable during testing.
    • late

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