小编dar*_*vil的帖子

单元测试 StreamingOuput 作为响应实体 Jersey

我正在做类似于在泽西岛使用 StreamingOutput 作为响应实体的示例中提到的事情

@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response streamExample(@Context UriInfo uriInfo) {
  StreamingOutput stream = new StreamingOutput() {
    @Override
    public void write(OutputStream os) throws IOException,WebApplicationException {
    try{
      Writer writer = new BufferedWriter(new OutputStreamWriter(os));
      //Read resource from jar
      InputStream inputStream = getClass().getClassLoader().getResourceAsStream("public/" + uriInfo.getPath());

      ...//manipulate the inputstream and build string with StringBuilder here//.......
      String inputData = builder.toString();
      Writer writer = new BufferedWriter(new OutputStreamWriter(os));
      writer.write(inputData);
      writer.flush();
    } catch (ExceptionE1) {
        throw new WebApplicationException();
      }
    }
};
  return Response.ok(stream,MediaType.APPLICATION_OCTET_STREAM).build();
}
Run Code Online (Sandbox Code Playgroud)

我试图通过模拟 URIInfo …

unit-testing jar jersey junit4 mockito

3
推荐指数
1
解决办法
1872
查看次数

使用 JavaScript 的 Cobertura

Cobertura 是否已知用于 JavaScript 代码库中的代码覆盖率? http://cobertura.github.io/cobertura/说它是用于 Java 代码库的。

javascript code-coverage cobertura

1
推荐指数
1
解决办法
2179
查看次数

sap.m.Title 与 sap.ui.core.Title 有什么区别

sap.ui.core.Title和 之间的主要区别是sap.m.Title什么?是否有特定的限制、约定甚至Fiori 指南何时使用哪个控件?

看起来 sap.m.Title 较新,但使用来自 sap.ui.core 的对象。

sapui5

1
推荐指数
1
解决办法
1636
查看次数