问题描述
我需要有关Arquillian测试的帮助。
添加情况的代码示例。 该代码在实际环境中可以正常工作。仅在使用Arquillian制作的测试用例中,结果是无法预期的
代码:
@Stateless
public class CustomerResourceImpl implements CustomerResource{
@Override
public Response findOne(String id) {
String res = "Un cliente";
return Response.ok(res).build();
}
}
@Path("customer")
@Produces(MediaType.APPLICATION_JSON)
public interface CustomerResource {
@GET
@Path("/findOne")
public javax.ws.rs.core.Response findOne(@QueryParam("id") String id);
}
这个测试用例
@RunWith(Arquillian.class)
public class CustomerResourceTest {
@Deployment (testable = false)
public static Archive createTestArchive() {
return ShrinkWrap
..... (mas)
.addAsWebInfResource(EmptyAsset.INSTANCE,"beans.xml");
}
@ArquillianResource
private URL deploymentURL;
@Test
@RunAsClient
public void findOne(@ArquillianResteasyResource CustomerResource resource) throws Exception {
final Response response = resource.findOne("1");
System.out.println(response.getEntity()); // IS NULL ??
System.out.println(response.getStatus()); // 200 OK
assertNotNull(response);
}
}
问题在于response.getEntity()始终为NULL。为什么?状态响应OK = 200,就可以了。该服务在Java 8的jboss 7.2中可以正常运行。
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)