我嘗試使用'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