Arquillian 統合テスト フレームワークを使用してテストを実行します。「Arquillian はテスト アーカイブを分離するためにクラスパス全体を使用しません。代わりに、アーカイブを作成するための Java API である ShrinkWrap クラスを使用します。テストするアーカイブを作成するとき、使用するクラスパスに含めるファイルを指定します。展開中、ShrinkWrap はテストに必要なクラスのみを分離します」( Introduction to Testing with Arquillian )。
私の構成があります:
@Deployment
public static WebArchive createDeployment() {
MavenResolverSystem resolver = Maven.resolver();
File[] files = resolver.loadPomFromFile("pom.xml").importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();
WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war");
webArchive.addAsLibraries(files)
.addClasses("There I add my classess")
.addAsManifestResource("arquillian/arquillian.xml");
System.out.println(webArchive.toString(true));
return webArchive;
}
そして pom.xml:
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-tomcat-embedded-8</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
しかし、スタックトレースでエラーが発生しています:
java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive com.project.MyControllerTest.createDeployment()
Caused by: java.lang.IllegalArgumentException: No dependencies were set for resolution
INFO: Stopping service [arquillian-tomcat-embedded]
私が逃したものは何ですか?