public class TestLoggingEventBuilder extends DefaultLoggingEventBuilder
LoggingEventBuilder which changes the following compared to DefaultLoggingEventBuilder:
toLoggingEvent() method is added to build the event without logging it.
TestLoggingEventBuilder. This allows
toLoggingEvent() to be used in a fluent manner.
KeyValuePair implementation overrides the Object.equals(java.lang.Object) and Object.hashCode() methods. This allows tests for equality in test assertions.
| Modifier and Type | Class and Description |
|---|---|
static class |
TestLoggingEventBuilder.TestKeyValuePair
Extension of
KeyValuePair with overridden Object.equals(java.lang.Object) and Object.hashCode() methods. |
logger, loggingEvent| Constructor and Description |
|---|
TestLoggingEventBuilder(Logger logger,
Level level) |
| Modifier and Type | Method and Description |
|---|---|
TestLoggingEventBuilder |
addArgument(Object p) |
TestLoggingEventBuilder |
addArgument(Supplier<?> objectSupplier) |
TestLoggingEventBuilder |
addKeyValue(String key,
Object value) |
TestLoggingEventBuilder |
addKeyValue(String key,
Supplier<Object> valueSupplier) |
TestLoggingEventBuilder |
addMarker(Marker marker) |
TestLoggingEventBuilder |
setCause(Throwable cause) |
TestLoggingEventBuilder |
setMessage(String message) |
TestLoggingEventBuilder |
setMessage(Supplier<String> messageSupplier) |
LoggingEvent |
toLoggingEvent()
Build the event, without logging it.
|
log, log, log, log, log, log, log, setCallerBoundarypublic LoggingEvent toLoggingEvent()
@CheckReturnValue public TestLoggingEventBuilder setCause(Throwable cause)
setCause in interface LoggingEventBuildersetCause in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder addMarker(Marker marker)
addMarker in interface LoggingEventBuilderaddMarker in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder addArgument(Object p)
addArgument in interface LoggingEventBuilderaddArgument in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder addArgument(Supplier<?> objectSupplier)
addArgument in interface LoggingEventBuilderaddArgument in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder addKeyValue(String key, Object value)
addKeyValue in interface LoggingEventBuilderaddKeyValue in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder addKeyValue(String key, Supplier<Object> valueSupplier)
addKeyValue in interface LoggingEventBuilderaddKeyValue in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder setMessage(String message)
setMessage in interface LoggingEventBuildersetMessage in class DefaultLoggingEventBuilder@CheckReturnValue public TestLoggingEventBuilder setMessage(Supplier<String> messageSupplier)
setMessage in interface LoggingEventBuildersetMessage in class DefaultLoggingEventBuilderCopyright © 2023. All rights reserved.