ppkarwasz commented on issue #3011:
URL:
https://github.com/apache/logging-log4j2/issues/3011#issuecomment-2593440525
What you want to test is the behavior of the `Builder` class. Since
`HttpAppenderTest` is a heavy test that starts up an HTTP server, I would
rather create a new `HttpAppenderBuilderTest` to test the builder.
The builder needs to test that the required properties (`name`, `url` and
`layout`) are present, before creating the appender. So, for example, you could
test that:
```java
HttpAppender.newBuilder()
.setName("HTTP")
.setUrl(new URL("https://localhost"))
.build();
```
returns `null` and logs an `ERROR` status logger message. To capture the
status logger messages for a test case, we have an `@UsingStatusListener`
annotation that injects a `ListStatusListener` into the test parameters. The
`@UsingStatusListener` annotation is for example used here.
https://github.com/apache/logging-log4j2/blob/6e3f2e23437d2876f5db2b72bd82b8a34a61b285/log4j-core-test/src/test/java/org/apache/logging/log4j/core/pattern/HighlightConverterTest.java#L195-L211
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]