Class LoggerAuditingExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension

    public class LoggerAuditingExtension
    extends Object
    implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
    Utility for auditing logged messages.(Junit5 extension)

    Implementation note: Make sure to not expose log4j dependencies in the interface of this class to ease updates in logging infrastructure.

    • Constructor Detail

      • LoggerAuditingExtension

        public LoggerAuditingExtension​(Class<?> clazz,
                                       org.slf4j.event.Level level)
      • LoggerAuditingExtension

        public LoggerAuditingExtension​(String loggerName,
                                       org.slf4j.event.Level level)
    • Method Detail

      • getEvents

        public List<org.apache.logging.log4j.core.LogEvent> getEvents()
      • getLoggerName

        public String getLoggerName()
      • beforeEach

        public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
                        throws Exception
        Specified by:
        beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
        Throws:
        Exception
      • afterEach

        public void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)
                       throws Exception
        Specified by:
        afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
        Throws:
        Exception