Class JUnitEasyLogger

java.lang.Object
com.github.tadukoo.util.logger.EasyLogger
com.github.tadukoo.junit.logger.JUnitEasyLogger

public class JUnitEasyLogger extends com.github.tadukoo.util.logger.EasyLogger
JUnit Easy Logger is used when we don't want to create an actual log file during a JUnit test, but want to verify that logging occurred properly. It contains a List of JUnit Easy Logger Entries that can be checked to verify log entries
Version:
Alpha v.0.1
Author:
Logan Ferree (Tadukoo)
  • Field Details

  • Constructor Details

    • JUnitEasyLogger

      public JUnitEasyLogger()
      Constructs a new JUnit Easy Logger with a null Logger and empty entries List
  • Method Details

    • getEntries

      Returns:
      The List of logger entries for this logger
    • assertEntries

      public static void assertEntries(Level level, String message, Throwable t, JUnitEasyLogger logger)
      Will verify that the entries in the given logger contains one element with the given Level, message, and Throwable
      Parameters:
      level - The Level of the entry we're expecting
      message - The message of the entry we're expecting
      t - The Throwable of the entry we're expecting
      logger - The JUnitEasyLogger to check entries we actually have
    • assertEntries

      public static void assertEntries(Level level, String message, Throwable t, List<JUnitEasyLogger.JUnitEasyLoggerEntry> actualEntries)
      Will verify that the given actual entries contains one element with the given Level, message, and Throwable
      Parameters:
      level - The Level of the entry we're expecting
      message - The message of the entry we're expecting
      t - The Throwable of the entry we're expecting
      actualEntries - The entries we actually have
    • assertEntries

      public static void assertEntries(JUnitEasyLogger.JUnitEasyLoggerEntry expectedEntry, JUnitEasyLogger logger)
      Will verify that the entries in the given logger contains one element and matches the expected entry
      Parameters:
      expectedEntry - The entry we're expecting
      logger - The JUnitEasyLogger to check entries we actually have
    • assertEntries

      public static void assertEntries(JUnitEasyLogger.JUnitEasyLoggerEntry expectedEntry, List<JUnitEasyLogger.JUnitEasyLoggerEntry> actualEntries)
      Will verify that the given actual entries contains one element and matches the expected entry
      Parameters:
      expectedEntry - The entry we're expecting
      actualEntries - The entries we actually have
    • assertEntries

      public static void assertEntries(List<JUnitEasyLogger.JUnitEasyLoggerEntry> expectedEntries, JUnitEasyLogger logger)
      Will verify that the entries in the given logger match the expected entries.
      Parameters:
      expectedEntries - The entries we're expecting
      logger - The JUnitEasyLogger to check entries we actually have
    • assertEntries

      public static void assertEntries(List<JUnitEasyLogger.JUnitEasyLoggerEntry> expectedEntries, List<JUnitEasyLogger.JUnitEasyLoggerEntry> actualEntries)
      Will verify that the given actual entries match the expected entries.
      Parameters:
      expectedEntries - The entries we're expecting
      actualEntries - The entries we actually have
    • logInfo

      public void logInfo(String info)
      Logs the given info message to the Logger
      Overrides:
      logInfo in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      info - The message to be logged
    • logInfo

      public void logInfo(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged as info
      Overrides:
      logInfo in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logInfo

      public void logInfo(String info, Throwable t)
      Logs the given info message with the given Throwable to the Logger
      Overrides:
      logInfo in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      info - The message to be logged
      t - The Throwable to be logged
    • logWarning

      public void logWarning(String warning)
      Logs the given warning message to the Logger
      Overrides:
      logWarning in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      warning - The message to be logged
    • logWarning

      public void logWarning(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged as a warning
      Overrides:
      logWarning in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logWarning

      public void logWarning(String warning, Throwable t)
      Logs the given warning message with the given Throwable to the Logger
      Overrides:
      logWarning in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      warning - The message to be logged
      t - The Throwable to be logged
    • logError

      public void logError(String error)
      Logs the given error message to the Logger
      Overrides:
      logError in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      error - The message to be logged
    • logError

      public void logError(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged as an error
      Overrides:
      logError in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logError

      public void logError(String error, Throwable t)
      Logs the given error message with the given Throwable to the Logger
      Overrides:
      logError in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      error - The message to be logged
      t - The Throwable to be logged
    • logConfig

      public void logConfig(String config)
      Logs the given config message to the Logger
      Overrides:
      logConfig in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      config - The message to be logged
    • logConfig

      public void logConfig(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged as a config message
      Overrides:
      logConfig in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logConfig

      public void logConfig(String config, Throwable t)
      Logs the given config message with the given Throwable to the Logger
      Overrides:
      logConfig in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      config - The message to be logged
      t - The Throwable to be logged
    • logDebugFine

      public void logDebugFine(String debug)
      Logs the given debug message to the Logger at Level.FINE
      Overrides:
      logDebugFine in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      debug - The message to be logged
    • logDebugFine

      public void logDebugFine(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged at Level.FINE
      Overrides:
      logDebugFine in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logDebugFine

      public void logDebugFine(String debug, Throwable t)
      Logs the given debug message with the given Throwable to the Logger at Level.FINE
      Overrides:
      logDebugFine in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      debug - The message to be logged
      t - The Throwable to be logged
    • logDebugFiner

      public void logDebugFiner(String debug)
      Logs the given debug message to the Logger at Level.FINER
      Overrides:
      logDebugFiner in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      debug - The message to be logged
    • logDebugFiner

      public void logDebugFiner(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged at Level.FINER
      Overrides:
      logDebugFiner in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logDebugFiner

      public void logDebugFiner(String debug, Throwable t)
      Logs the given debug message with the given Throwable to the Logger at Level.FINER
      Overrides:
      logDebugFiner in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      debug - The message to be logged
      t - The Throwable to be logged
    • logDebugFinest

      public void logDebugFinest(String debug)
      Logs the given debug message to the Logger at Level.FINEST
      Overrides:
      logDebugFinest in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      debug - The message to be logged
    • logDebugFinest

      public void logDebugFinest(Throwable t)
      Logs the given Throwable to the Logger. Uses Throwable.getMessage() as the message on the log entry. This entry is logged at Level.FINEST
      Overrides:
      logDebugFinest in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      t - The Throwable to be logged
    • logDebugFinest

      public void logDebugFinest(String debug, Throwable t)
      Logs the given debug message with the given Throwable to the Logger at Level.FINEST
      Overrides:
      logDebugFinest in class com.github.tadukoo.util.logger.EasyLogger
      Parameters:
      debug - The message to be logged
      t - The Throwable to be logged