-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Just tried the following:
@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = { Bla.class },
webEnvironment = WebEnvironment.NONE)
@ActiveProfiles("test")
@LogCollectorExtension
public class FooTest {
...
Logger logger = LoggerFactory.getLogger(Foo.class);
JUnit5LogCollector collector = new JUnit5LogCollector(logger);
...
@Test
public void testFoo() {
doSomethingWithFoo();
// NPE happens here
collector.getLogs().stream().forEach(log -> System.out.println(log));
}
...
}
It dies with:
java.lang.NullPointerException
at dk.bitcraft.lc.Log4j2Collector.getResult(Log4j2Collector.java:41)
at dk.bitcraft.lc.JUnit5LogCollector.getLogs(JUnit5LogCollector.java:28)
at com.acme.FooTest.testFoo(FooTest.java:131)
Seems like the appender
in Log4j2Collector
isn't properly initialized. Maybe somehow setup()
isn't called properly?
Metadata
Metadata
Assignees
Labels
No labels