Browsed by
Tag: unit-test

Java/Kotlin Unit Testing – Test Stdout/Stderr/Logs

Java/Kotlin Unit Testing – Test Stdout/Stderr/Logs

Note: see also my old blog post if you want a more complex solution 😉 It targets at replacing the log appender. The below described method is simpler (nice!), it just listens in on ALL standard output+errors. When using spring-boot unit testing (library spring-boot-test-2.6.2.jar or newer), you can capture the output as send to the standard out and standard error channels. This allows for example testing output to log statements (by sending logs to stdout / console appender). From the…

Read More Read More