我尝试使用'ArquillianResteasyResource'在我的测试中注入WebTarget,但WebTarget的变量保持为空。(Arquillian REST扩展)为什么webtarget在测试方法中为null?
@Test
@Consumes(MediaType.APPLICATION_JSON)
public void testWithWT(@ArquillianResteasyResource WebTarget webTarget) {
......}
当我直接注入我的班级服务,一切工作正常!
@Test
@Consumes(MediaType.APPLICATION_JSON)
public void testWithWT(@ArquillianResteasyResource MyService sv) {
......}
我POM依赖关系:
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.eu.ingwar.tools</groupId> <artifactId>arquillian-suite-extension</artifactId> <version>1.1.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.junit</groupId> <artifactId>arquillian-junit-container</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.wildfly.arquillian</groupId> <artifactId>wildfly-arquillian-container-embedded</artifactId> <version>1.0.1.Final</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.extension</groupId> <artifactId>arquillian-rest-client-api</artifactId> <version>1.0.0.Alpha3</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.extension</groupId> <artifactId>arquillian-rest-client-impl-3x</artifactId> <version>1.0.0.Alpha3</version> <scope>test</scope> </dependency> <dependency> <groupId>org.wildfly</groupId> <artifactId>wildfly-embedded</artifactId> <version>9.0.0.Final</version> <scope>test</scope> </dependency>
什么是与WebTarget问题?
有什么想法?
问候
这是服务器端还是客户端测试?正在使用哪个版本的RestEasy? – LightGuard
这是一个服务器端测试。我使用3.0.11.Final版本的RestEasy。 – Seb
当然看起来像一个bug。 – LightGuard