【发布时间】:2016-05-16 21:10:46
【问题描述】:
我创建了我的资源来处理一些图像,我想用 JUnit 的@ClassRule 测试它们,就像我以前一样。它们看起来像这样:
@Path("/myImage")
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response postImage(
@FormDataParam("file") InputStream inputStream) {
//doStuff
}
现在,我想对其进行测试,但遇到了问题。我争取这个班级规则会好的
@ClassRule
public static final ResourceTestRule resources = ResourceTestRule.builder()
.addResource(new MyResource())
.addResource(new MultiPartBundle())
.build();
但我仍然收到错误
org.glassfish.jersey.server.model.ModelValidationException:应用程序资源模型的验证在应用程序初始化期间失败。
[[致命] 没有找到公共类型参数的注入源 ...
如何为这个问题写一个合适的类规则?
【问题讨论】:
标签: java jersey multipartform-data dropwizard multipart