如何在部署前对 spring 引导中的 splunk 登录进行单元测试?
How can I unit test splunk logging in spring boot before deployment?
如何在 spring 引导预部署中对 splunk 登录进行单元测试?
有没有库可以测试内存日志?
我在我的应用程序中使用 'org.slf4j.Logger' 进行登录。
谢谢!
安舒曼
假设您正在登录到 System.out 或 System.err,有一个 Junit 规则 Spring Boot 提供来捕获这些流。
示例来自 Spring 文档,
public class MyTest {
@Rule
public OutputCapture capture = new OutputCapture();
@Test
public void testName() throws Exception {
System.out.println("Hello World!");
assertThat(capture.toString(), containsString("World"));
}
}
如何在 spring 引导预部署中对 splunk 登录进行单元测试?
有没有库可以测试内存日志?
我在我的应用程序中使用 'org.slf4j.Logger' 进行登录。
谢谢! 安舒曼
假设您正在登录到 System.out 或 System.err,有一个 Junit 规则 Spring Boot 提供来捕获这些流。
示例来自 Spring 文档,
public class MyTest {
@Rule
public OutputCapture capture = new OutputCapture();
@Test
public void testName() throws Exception {
System.out.println("Hello World!");
assertThat(capture.toString(), containsString("World"));
}
}