【发布时间】:2020-08-18 22:03:29
【问题描述】:
我的 REST API 在部署时工作正常,但我的测试使用 Jersey Arquillian 扩展失败:
@Test
@RunAsClient
public void postTest(@ArquillianResteasyResource final WebTarget webTarget) {
MyRequest request = new MyRequest();
String response = webTarget.path("/demo").request(MediaType.APPLICATION_JSON)
.post(Entity.json(request)).readEntity(String.class);
Assert.assertEquals("OK", response);
}
我得到错误:
Error HTTP method POST is not supported by this URL
我的 JAX-RS 程序看起来不错:
@ApplicationPath("api")
public class JaxRsActivator extends Application {
}
@Path("/demo")
@Stateless
public class DemoResource extends BaseResource {
@POST
public Response demo(MyRequest request) {
return Response.ok().entity("OK").build();
}
}
【问题讨论】:
标签: java resteasy jboss-arquillian