我正在使用 org.springframework.boot.test.OutputCapture 来测试记录某些内容的注释。
它对于单个测试非常有效,并且当单独运行测试时,如果源文件中存在使用输出捕获的多个测试,但是当多个测试一起运行时,只有第一个测试运行获取捕获的输出,其他测试运行获取空字符串。
有什么办法可以避免这种情况,我看不到任何配置的可能性吗?
这是一个简化的测试,说明了 import static org.hamcrest.Matchers 问题。; 导入静态 org.junit.Assert。;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.springframework.boot.test.OutputCapture;
/**
* Simplest implementation that illustrates my problem using {@link OutputCapture}.
* <p>
* If both tests are run, the second test run will not have any output captured so fails.
* If tests are run individually they both pass.
* <p>
* It is somehow related to …Run Code Online (Sandbox Code Playgroud) Spring Integration Java DSL 有没有办法修改现有的消息头?
我正在使用 SI Java DSL 重新实现下载重试机制,并且希望在发生失败时增加保存下载尝试的消息标头,然后根据与限制相比的尝试次数路由消息。
我的路由基于 SI 中包含的 RouterTests 运行良好。使用 HeaderEnrichers 我可以轻松添加标头,但我看不到修改现有标头的方法。
谢谢
/**
* Unit test of {@link RetryRouter}.
*
* Based on {@link RouterTests#testMethodInvokingRouter2()}.
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class RetryRouterTests {
/** Failed download attempts are sent to this channel to be routed by {@link ContextConfiguration#failedDownloadRouting( ) } */
@Autowired
@Qualifier("failed")
private MessageChannel failed;
/** Retry attempts for failed downloads are sent to this channel by {@link ContextConfiguration#failedDownloadRouting( ) }*/
@Autowired
@Qualifier("retry-channel") …Run Code Online (Sandbox Code Playgroud) 我正在建立一个新的多模块gradle项目,将在jenkins中构建,并试图让sonarqube分析它,但我遇到了一些我无法解决的不兼容问题.
我正在寻找使用
如果我使用gradle 3,我会收到此错误:org.gradle.internal.jvm.Jvm.getRuntimeJar()Ljava/io/File;
如果我使用gradle这个2.14我得到这个错误:产生java.io.IOException:由造成不兼容的版本1007这个错误在过去已经引起jacoco和sonarqube插件不兼容看到JaCoCo SonarQube不兼容的版本1007.
我应该使用哪些版本?