Skip to content

SDA Commons Server Weld Testing

javadoc

sda-commons-server-weld-testing is used to bootstrap Dropwizard applications inside a Weld-SE container using the DropwizardAppExtension during testing and provides CDI support for Servlets, listeners and resources.

Info: We at SDA SE do not use CDI in our microservices anymore. We believe that dependency injection is not helpful for small services. Therefore, this module is not actively maintained by SDA SE developers. Automated security upgrades are enabled. Contributions of new features and bug fixes are welcome.

Usage

Testing

To start a Dropwizard application during testing the WeldAppExtension can be used:

1
2
3
4
5
6
7
8
public class WeldAppITest {

  @RegisterExtension
  static final WeldAppExtension<AppConfiguration> APP =
      new WeldAppExtension<>(Application.class, ResourceHelpers.resourceFilePath("config.yml"));

    // ...
} 

The WeldAppExtension is a shortcut for creating a DropwizardAppExtension in combination with the WeldTestSupport.