Package de.cuioss.test.juli
Class LogAsserts
java.lang.Object
de.cuioss.test.juli.LogAsserts
Provides a number of asserts against the
LogRecord
s gathered by
TestLogHandler
. Caution: In order to use the asserts the
TestLogHandler
must be properly configured by calling
TestLoggerFactory.install()
prior to usage. Usually this is done by
EnableTestLogger
- Author:
- Oliver Wolff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertLogMessagePresent
(TestLogLevel logLevel, String message) Asserts whether at least oneLogRecord
for the given parameter is presentstatic void
assertLogMessagePresent
(TestLogLevel logLevel, String message, Class<? extends Throwable> throwableClass) Asserts whether at least oneLogRecord
for the given parameter is presentstatic void
assertLogMessagePresent
(TestLogLevel logLevel, String message, Throwable throwable) Asserts whether at least oneLogRecord
for the given parameter is presentstatic void
assertLogMessagePresentContaining
(TestLogLevel logLevel, String messagePart) Asserts whether at least oneLogRecord
for the given parameter is presentstatic void
assertLogMessagePresentContaining
(TestLogLevel logLevel, String messagePart, Class<? extends Throwable> throwableClass) Asserts whether at least oneLogRecord
for the given parameter is presentstatic void
assertLogMessagePresentContaining
(TestLogLevel logLevel, String messagePart, Throwable throwable) Asserts whether at least oneLogRecord
for the given parameter is presentstatic void
assertNoLogMessagePresent
(TestLogLevel logLevel, Class<?> logger) Asserts whether noLogRecord
for the given parameter is presentstatic void
assertNoLogMessagePresent
(TestLogLevel logLevel, String messagePart) Asserts whether noLogRecord
for the given parameter is presentstatic void
assertSingleLogMessagePresent
(TestLogLevel logLevel, String message) Asserts whether exactly oneLogRecord
for the given parameter is presentstatic void
assertSingleLogMessagePresent
(TestLogLevel logLevel, String message, Class<? extends Throwable> throwableClass) Asserts whether exactly oneLogRecord
for the given parameter is presentstatic void
assertSingleLogMessagePresent
(TestLogLevel logLevel, String message, Throwable throwable) Asserts whether exactly oneLogRecord
for the given parameter is presentstatic void
assertSingleLogMessagePresentContaining
(TestLogLevel logLevel, String messagePart) Asserts whether exactly oneLogRecord
for the given parameter is presentstatic void
assertSingleLogMessagePresentContaining
(TestLogLevel logLevel, String messagePart, Class<? extends Throwable> throwableClass) Asserts whether exactly oneLogRecord
for the given parameter is presentstatic void
assertSingleLogMessagePresentContaining
(TestLogLevel logLevel, String messagePart, Throwable throwable) Asserts whether exactly oneLogRecord
for the given parameter is present
-
Constructor Details
-
LogAsserts
public LogAsserts()
-
-
Method Details
-
assertLogMessagePresent
Asserts whether at least oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessage
- to be checked, must not be null
-
assertNoLogMessagePresent
Asserts whether noLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be null
-
assertNoLogMessagePresent
Asserts whether noLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nulllogger
- to be checked, must not be null
-
assertSingleLogMessagePresent
Asserts whether exactly oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessage
- to be checked, must not be null
-
assertLogMessagePresent
public static void assertLogMessagePresent(TestLogLevel logLevel, String message, Throwable throwable) Asserts whether at least oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessage
- to be checked, must not be nullthrowable
- to be checked, must not be null
-
assertSingleLogMessagePresent
public static void assertSingleLogMessagePresent(TestLogLevel logLevel, String message, Throwable throwable) Asserts whether exactly oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessage
- to be checked, must not be nullthrowable
- to be checked, must not be null
-
assertLogMessagePresent
public static void assertLogMessagePresent(TestLogLevel logLevel, String message, Class<? extends Throwable> throwableClass) Asserts whether at least oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessage
- to be checked, must not be nullthrowableClass
- to be checked, must not be null
-
assertSingleLogMessagePresent
public static void assertSingleLogMessagePresent(TestLogLevel logLevel, String message, Class<? extends Throwable> throwableClass) Asserts whether exactly oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessage
- to be checked, must not be nullthrowableClass
- to be checked, must not be null
-
assertLogMessagePresentContaining
Asserts whether at least oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be null
-
assertSingleLogMessagePresentContaining
public static void assertSingleLogMessagePresentContaining(TestLogLevel logLevel, String messagePart) Asserts whether exactly oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be null
-
assertLogMessagePresentContaining
public static void assertLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Throwable throwable) Asserts whether at least oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be nullthrowable
- to be checked, must not be null
-
assertLogMessagePresentContaining
public static void assertLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Class<? extends Throwable> throwableClass) Asserts whether at least oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be nullthrowableClass
- to be checked, must not be null
-
assertSingleLogMessagePresentContaining
public static void assertSingleLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Throwable throwable) Asserts whether exactly oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be nullthrowable
- to be checked, must not be null
-
assertSingleLogMessagePresentContaining
public static void assertSingleLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Class<? extends Throwable> throwableClass) Asserts whether exactly oneLogRecord
for the given parameter is present- Parameters:
logLevel
- to be checked, must not be nullmessagePart
- to be checked, must not be nullthrowableClass
- to be checked, must not be null
-