ダビデは回復モニカ言います:
JUnitの4で、私のような何かを行うことができます
@ClassRule
public DropwizardAppRule<Configuration> app = new DropwizardAppRule<>(MyApp.class);
...
app.getLocalPort()
どのように私はJUnitの5でこの動作を再現できますか?この githubの問題、それは私が使用する必要があるように思える@ExtendWith(DropwizardExtensionsSupport.class)
が、その不明確方法
アレックスShesterov:
Dropwizard 1.3.0を追加導入することにより、JUnit5サポートをDropwizardExtensionsSupport
クラスを。
あなたは(何をしている、あなたのテストの開始/終了時にアプリケーションを停止/起動する必要がある場合は具体的には、DropwizardAppRule
ありません)、がありますDropwizardAppExtension
利用可能に。
JUnit5のために書き直さあなたの例、:
@ExtendWith(DropwizardExtensionsSupport.class)
public class MyTest {
public static final DropwizardAppExtension<Config> app = new DropwizardAppExtension<>(MyApp.class);
...
// app.getLocalPort() is also available
}
残念ながら、JUnit5のサポートはまだ文書化されていないようです。
リンク: