@Retention(value=RUNTIME) @Target(value=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!
}
}
Copyright © 2017–2018. All rights reserved.