Class MockLogging

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class MockLogging
    extends org.junit.rules.ExternalResource
    • Constructor Summary

      Constructors 
      Constructor Description
      MockLogging()  
      MockLogging​(org.apache.log4j.Level logLevel)  
      MockLogging​(org.apache.log4j.Level logLevel, org.assertlog.OriginalLogsPolicy policy)  
      MockLogging​(org.assertlog.OriginalLogsPolicy policy)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void after()  
      void assertLogged​(java.lang.String level, java.lang.String message)  
      void assertLogged​(java.lang.String loggerName, java.lang.String level, java.lang.String message)  
      void assertLogged​(java.lang.String level, java.lang.String message, java.lang.Throwable exception)  
      void assertLogged​(java.lang.String level, java.util.regex.Pattern pattern)  
      void assertLogged​(java.util.regex.Pattern pattern)
      Must use assertNotLogged before all assertLogged methods, as they remove elements from queue
      void assertLoggedInAnyOrder​(java.lang.String level, java.lang.String message)  
      void assertNoMoreLogs()  
      void assertNotLogged​(java.util.regex.Pattern pattern)
      Must use assertNotLogged before all assertLogged methods, as they remove elements from queue
      protected void before()  
      void clear()  
      org.apache.log4j.spi.LoggingEvent getLoggedEvent()  
      • Methods inherited from class org.junit.rules.ExternalResource

        apply
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockLogging

        public MockLogging()
      • MockLogging

        public MockLogging​(org.apache.log4j.Level logLevel)
      • MockLogging

        public MockLogging​(org.assertlog.OriginalLogsPolicy policy)
      • MockLogging

        public MockLogging​(org.apache.log4j.Level logLevel,
                           org.assertlog.OriginalLogsPolicy policy)
    • Method Detail

      • assertNoMoreLogs

        public void assertNoMoreLogs()
      • assertLogged

        public void assertLogged​(java.lang.String loggerName,
                                 java.lang.String level,
                                 java.lang.String message)
      • assertLogged

        public void assertLogged​(java.lang.String level,
                                 java.lang.String message)
      • assertLoggedInAnyOrder

        public void assertLoggedInAnyOrder​(java.lang.String level,
                                           java.lang.String message)
      • assertLogged

        public void assertLogged​(java.lang.String level,
                                 java.util.regex.Pattern pattern)
      • assertLogged

        public void assertLogged​(java.util.regex.Pattern pattern)
        Must use assertNotLogged before all assertLogged methods, as they remove elements from queue
      • assertNotLogged

        public void assertNotLogged​(java.util.regex.Pattern pattern)
        Must use assertNotLogged before all assertLogged methods, as they remove elements from queue
      • assertLogged

        public void assertLogged​(java.lang.String level,
                                 java.lang.String message,
                                 java.lang.Throwable exception)
      • getLoggedEvent

        public org.apache.log4j.spi.LoggingEvent getLoggedEvent()
      • clear

        public void clear()
      • before

        protected void before()
        Overrides:
        before in class org.junit.rules.ExternalResource
      • after

        protected void after()
        Overrides:
        after in class org.junit.rules.ExternalResource