java.lang.Object
de.cuioss.test.juli.LogAsserts
Provides a number of asserts against the
LogRecords 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 voidassertLogMessagePresent(TestLogLevel logLevel, String message) Asserts whether at least oneLogRecordfor the given parameter is presentstatic voidassertLogMessagePresent(TestLogLevel logLevel, String message, Class<? extends Throwable> throwableClass) Asserts whether at least oneLogRecordfor the given parameter is presentstatic voidassertLogMessagePresent(TestLogLevel logLevel, String message, Throwable throwable) Asserts whether at least oneLogRecordfor the given parameter is presentstatic voidassertLogMessagePresentContaining(TestLogLevel logLevel, String messagePart) Asserts whether at least oneLogRecordfor the given parameter is presentstatic voidassertLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Class<? extends Throwable> throwableClass) Asserts whether at least oneLogRecordfor the given parameter is presentstatic voidassertLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Throwable throwable) Asserts whether at least oneLogRecordfor the given parameter is presentstatic voidassertNoLogMessagePresent(TestLogLevel logLevel, Class<?> logger) Asserts whether noLogRecordfor the given parameter is presentstatic voidassertNoLogMessagePresent(TestLogLevel logLevel, String messagePart) Asserts whether noLogRecordfor the given parameter is presentstatic voidassertSingleLogMessagePresent(TestLogLevel logLevel, String message) Asserts whether exactly oneLogRecordfor the given parameter is presentstatic voidassertSingleLogMessagePresent(TestLogLevel logLevel, String message, Class<? extends Throwable> throwableClass) Asserts whether exactly oneLogRecordfor the given parameter is presentstatic voidassertSingleLogMessagePresent(TestLogLevel logLevel, String message, Throwable throwable) Asserts whether exactly oneLogRecordfor the given parameter is presentstatic voidassertSingleLogMessagePresentContaining(TestLogLevel logLevel, String messagePart) Asserts whether exactly oneLogRecordfor the given parameter is presentstatic voidassertSingleLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Class<? extends Throwable> throwableClass) Asserts whether exactly oneLogRecordfor the given parameter is presentstatic voidassertSingleLogMessagePresentContaining(TestLogLevel logLevel, String messagePart, Throwable throwable) Asserts whether exactly oneLogRecordfor the given parameter is present
-
Constructor Details
-
LogAsserts
public LogAsserts()
-
-
Method Details
-
assertLogMessagePresent
Asserts whether at least oneLogRecordfor the given parameter is present- Parameters:
logLevel- to be checked, must not be nullmessage- to be checked, must not be null
-
assertNoLogMessagePresent
Asserts whether noLogRecordfor the given parameter is present- Parameters:
logLevel- to be checked, must not be nullmessagePart- to be checked, must not be null
-
assertNoLogMessagePresent
Asserts whether noLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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 oneLogRecordfor 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
-