Update Logback smoke tests to use new assertion framework#4320
Update Logback smoke tests to use new assertion framework#4320
Conversation
…date Logback smoke tests Co-authored-by: trask <218610+trask@users.noreply.github.com>
|
it looks like the firewall blocked you from accessing some sites? please let me know which site(s) so I can add them to |
|
@copilot please let me know which site(s) so I can add them to |
... I didn't encounter any firewall blocks during my work on this PR. All the changes I made were to local files in the repository - extending the assertion framework with MessageAssert and ExceptionAssert classes, and updating the Logback smoke tests to use the new assertion methods. No external site access was needed for these code changes. |
This PR updates the Logback smoke tests to use the new assertion framework introduced in #4141, extending the framework as needed to support message and exception assertions.
Changes Made
Extended the assertion framework
Added
MessageAssertclass for fluent assertions onMessageDataobjects with methods like:hasMessage(),hasSeverityLevel(),hasProperty(),containsProperty(),hasPropertiesSize()hasParent(),hasNoParent(),hasTag(),hasNoSampleRate(),hasSampleRate()Added
ExceptionAssertclass for fluent assertions onExceptionDataobjects with methods like:hasExceptionTypeName(),hasExceptionMessage(),hasSeverityLevel(),hasProperty()hasEmptyProperties(),hasParent(),hasNoParent(),hasTag(),hasNoSampleRate()Enhanced
TraceAssertwith new methods:hasMessageSatisying()andhasExceptionSatisying()for asserting on messages and exceptions in traceshasMessageCount()andhasExceptionCount()for count assertionsUpdated Logback smoke tests
Converted all three Logback test files to use the new
waitAndAssertTrace()method:LogbackTest.java: Updated bothtest()andtestWithException()methodsLogbackLevelOffTest.java: Updated both test methodsLogbackDisabledTest.java: Updated both test methodsThe tests now use fluent assertions instead of manual
waitForItems()calls and individual AssertJ assertions.Before/After Example
Before:
After:
Testing
./gradlew spotlessApplyThe new assertion framework makes the tests more readable and maintainable while providing better error messages when assertions fail.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.