是否可以在消费者中运行方法,如方法引用,但是在传递给使用者的对象上:
Arrays.stream(log.getHandlers()).forEach(h -> h.close());
Run Code Online (Sandbox Code Playgroud)
会是这样的事情:
Arrays.stream(log.getHandlers()).forEach(this::close);
Run Code Online (Sandbox Code Playgroud)
但那不行......
是否有可能使用方法参考,或者是x -> x.method()
唯一可以在这里工作的方法?
在JUnit中,您可以使用@Ignore
before方法告诉测试运行器自动跳过这些测试.从我可以收集的内容来看,这实际上只是一种方便的方式来记录/标记您想要稍后返回的不完整/不再有功能的测试.
我是否正确地说,在运行时,@Ignore
测试,没有注释的方法和注释掉的方法之间没有区别?(假设这些测试都是自包含的.)有没有办法在Netbeans上的JUnit中获取被忽略的测试用例列表?如果没有,@Ignore
标签真正有多大用处,因为失败测试可能更有用,所以它不会被忽视?
我有一个自定义EndpointInterceptor
实现;
@Component
public class MyEndpointInterceptor implements EndpointInterceptor {
@Autowired
private Jaxb2Marshaller marshaller;
@Override
public boolean handleRequest(MessageContext messageContext, Object o) throws Exception {
return true;
}
@Override
public boolean handleResponse(MessageContext messageContext, Object o) throws Exception {
return true;
}
@Override
public boolean handleFault(MessageContext messageContext, Object o) throws Exception {
return true;
}
@Override
public void afterCompletion(MessageContext messageContext, Object o, Exception e) throws Exception {
// ... do stuff with marshaller
}
}
Run Code Online (Sandbox Code Playgroud)
拦截器添加在扩展的配置类中WsConfigurerAdapter
;
@Configuration
@EnableWs
public class …
Run Code Online (Sandbox Code Playgroud) java ×3
ignore ×1
java-8 ×1
java-stream ×1
junit ×1
lambda ×1
netbeans ×1
spring-ws ×1
unit-testing ×1