@@ -48,19 +48,13 @@ public abstract class AbstractLogbackTest {
4848
4949 protected abstract InstrumentationExtension testing ();
5050
51- /**
52- * Override to install specific instrumentation before each test.
53- */
51+ /** Override to install specific instrumentation before each test. */
5452 protected void beforeEachTest () {}
5553
56- /**
57- * Override to clean up instrumentation after each test.
58- */
54+ /** Override to clean up instrumentation after each test. */
5955 protected void afterEachTest () {}
6056
61- /**
62- * Override to add instrumentation-specific thread attribute assertions.
63- */
57+ /** Override to add instrumentation-specific thread attribute assertions. */
6458 protected List <AttributeAssertion > threadAssertions () {
6559 return Collections .emptyList ();
6660 }
@@ -94,22 +88,16 @@ private static Stream<Arguments> parameters() {
9488 private List <AttributeAssertion > baseAssertions (String methodName ) {
9589 List <AttributeAssertion > assertions = new ArrayList <>(threadAssertions ());
9690 assertions .addAll (codeFunctionAssertions (AbstractLogbackTest .class , methodName ));
97- assertions .addAll (codeFileAndLineAssertions (AbstractLogbackTest .class .getSimpleName () + ".java" ));
91+ assertions .addAll (
92+ codeFileAndLineAssertions (AbstractLogbackTest .class .getSimpleName () + ".java" ));
9893 return assertions ;
9994 }
10095
10196 @ ParameterizedTest
10297 @ MethodSource ("parameters" )
10398 void logLevels (boolean logException , boolean withParent ) throws InterruptedException {
10499 logAndAssert (
105- ABC_LOGGER ,
106- Logger ::debug ,
107- Logger ::debug ,
108- logException ,
109- withParent ,
110- null ,
111- null ,
112- null );
100+ ABC_LOGGER , Logger ::debug , Logger ::debug , logException , withParent , null , null , null );
113101 testing ().clearData ();
114102 logAndAssert (
115103 ABC_LOGGER ,
@@ -142,24 +130,10 @@ void logLevels(boolean logException, boolean withParent) throws InterruptedExcep
142130 "ERROR" );
143131 testing ().clearData ();
144132 logAndAssert (
145- DEF_LOGGER ,
146- Logger ::debug ,
147- Logger ::debug ,
148- logException ,
149- withParent ,
150- null ,
151- null ,
152- null );
133+ DEF_LOGGER , Logger ::debug , Logger ::debug , logException , withParent , null , null , null );
153134 testing ().clearData ();
154135 logAndAssert (
155- DEF_LOGGER ,
156- Logger ::info ,
157- Logger ::info ,
158- logException ,
159- withParent ,
160- null ,
161- null ,
162- null );
136+ DEF_LOGGER , Logger ::info , Logger ::info , logException , withParent , null , null , null );
163137 testing ().clearData ();
164138 logAndAssert (
165139 DEF_LOGGER ,
@@ -224,10 +198,13 @@ private void logAndAssert(
224198
225199 List <AttributeAssertion > attributeAsserts = baseAssertions ("performLogging" );
226200 if (logException ) {
227- attributeAsserts .add (equalTo (EXCEPTION_TYPE , IllegalStateException .class .getName ()));
201+ attributeAsserts .add (
202+ equalTo (EXCEPTION_TYPE , IllegalStateException .class .getName ()));
228203 attributeAsserts .add (equalTo (EXCEPTION_MESSAGE , "hello" ));
229204 attributeAsserts .add (
230- satisfies (EXCEPTION_STACKTRACE , value -> value .contains (AbstractLogbackTest .class .getName ())));
205+ satisfies (
206+ EXCEPTION_STACKTRACE ,
207+ value -> value .contains (AbstractLogbackTest .class .getName ())));
231208 }
232209
233210 logRecord .hasAttributesSatisfyingExactly (attributeAsserts );
@@ -256,19 +233,19 @@ void logMdc() {
256233 assertions .add (equalTo (AttributeKey .stringKey ("event.name" ), "MyEventName" ));
257234 }
258235
259- testing ()
260- .waitAndAssertLogRecords (
261- logRecord -> {
262- logRecord
263- .hasBody ("xyz: 123" )
264- .hasInstrumentationScope (InstrumentationScopeInfo .builder ("abc" ).build ())
265- .hasSeverity (Severity .INFO )
266- .hasSeverityText ("INFO" )
267- .hasAttributesSatisfyingExactly (assertions );
268- if (expectEventName ()) {
269- logRecord .hasEventName ("MyEventName" );
270- }
271- });
236+ testing ()
237+ .waitAndAssertLogRecords (
238+ logRecord -> {
239+ logRecord
240+ .hasBody ("xyz: 123" )
241+ .hasInstrumentationScope (InstrumentationScopeInfo .builder ("abc" ).build ())
242+ .hasSeverity (Severity .INFO )
243+ .hasSeverityText ("INFO" )
244+ .hasAttributesSatisfyingExactly (assertions );
245+ if (expectEventName ()) {
246+ logRecord .hasEventName ("MyEventName" );
247+ }
248+ });
272249 }
273250
274251 @ Test
@@ -281,10 +258,10 @@ void logMarker() {
281258 List <AttributeAssertion > assertions = baseAssertions ("logMarker" );
282259 assertions .add (
283260 equalTo (
284- AttributeKey .stringArrayKey ("logback.marker" ),
285- Collections .singletonList (markerName )));
261+ AttributeKey .stringArrayKey ("logback.marker" ), Collections .singletonList (markerName )));
286262
287- testing ().waitAndAssertLogRecords (logRecord -> logRecord .hasAttributesSatisfyingExactly (assertions ));
263+ testing ()
264+ .waitAndAssertLogRecords (logRecord -> logRecord .hasAttributesSatisfyingExactly (assertions ));
288265 }
289266
290267 private static void performLogging (
0 commit comments