Class LogCaptorAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<LogCaptorAssert, nl.altindag.log.LogCaptor>
org.assertj.core.api.AbstractObjectAssert<LogCaptorAssert, nl.altindag.log.LogCaptor>
nl.pim16aap2.testing.assertions.LogCaptorAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<LogCaptorAssert, nl.altindag.log.LogCaptor>, org.assertj.core.api.Descriptable<LogCaptorAssert>, org.assertj.core.api.ExtensionPoints<LogCaptorAssert, nl.altindag.log.LogCaptor>
@NullMarked
public class LogCaptorAssert
extends org.assertj.core.api.AbstractObjectAssert<LogCaptorAssert, nl.altindag.log.LogCaptor>
An assertion class for
LogCaptor instances.
This class provides methods to assert various conditions on the logs captured by a LogCaptor. It extends
AbstractAssert from AssertJ to provide fluent assertions.
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Method Summary
Modifier and TypeMethodDescriptionstatic LogCaptorAssertassertThatLogCaptor(nl.altindag.log.LogCaptor actual) Creates a newLogCaptorAssertfor the givenLogCaptor.Gets all logs captured by theLogCaptor.atDebug()Gets all debug logs captured by theLogCaptor.atError()Gets all warning logs captured by theLogCaptor.atInfo()Gets all info logs captured by theLogCaptor.atTrace()Gets all trace logs captured by theLogCaptor.atWarn()Gets all warning logs captured by theLogCaptor.protected voidfailWithMessage(String errorMessage, Object... arguments) Verifies that no debug logs were captured.Verifies that no error logs were captured.Verifies that no info logs were captured.Verifies that no logs were captured.Verifies that no trace logs were captured.Verifies that no warning logs were captured.Methods inherited from class org.assertj.core.api.AbstractObjectAssert
as, as, doesNotReturn, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, getComparatorsByType, hasAllNullFieldsOrProperties, hasAllNullFieldsOrPropertiesExcept, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, hasOnlyFields, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, newObjectAssert, returns, usingComparatorForFields, usingComparatorForType, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparisonMethods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingEquals, usingEquals, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, describedAs, describedAs
-
Method Details
-
assertThatLogCaptor
Creates a newLogCaptorAssertfor the givenLogCaptor.- Parameters:
actual- TheLogCaptorto create the assertion for.- Returns:
- A new
LogCaptorAssertfor the givenLogCaptor.
-
failWithMessage
- Overrides:
failWithMessagein classorg.assertj.core.api.AbstractAssert<LogCaptorAssert, nl.altindag.log.LogCaptor>
-
atAllLevels
Gets all logs captured by theLogCaptor. The result may be empty.- Returns:
- A
LogEventsAssertcontaining the captured log events.
-
atError
Gets all warning logs captured by theLogCaptor. The result may be empty.- Returns:
- A
LogEventsAssertcontaining the log events at the specified level.
-
atWarn
Gets all warning logs captured by theLogCaptor. The result may be empty.- Returns:
- A
LogEventsAssertcontaining the log events at the specified level.
-
atInfo
Gets all info logs captured by theLogCaptor. The result may be empty.- Returns:
- A
LogEventsAssertcontaining the log events at the specified level.
-
atDebug
Gets all debug logs captured by theLogCaptor. The result may be empty.- Returns:
- A
LogEventsAssertcontaining the log events at the specified level.
-
atTrace
Gets all trace logs captured by theLogCaptor. The result may be empty.- Returns:
- A
LogEventsAssertcontaining the log events at the specified level.
-
hasNoLogs
Verifies that no logs were captured.- Returns:
thisassertion object
-
hasNoErrorLogs
Verifies that no error logs were captured.- Returns:
thisassertion object
-
hasNoWarnLogs
Verifies that no warning logs were captured.- Returns:
thisassertion object
-
hasNoInfoLogs
Verifies that no info logs were captured.- Returns:
thisassertion object
-
hasNoDebugLogs
Verifies that no debug logs were captured.- Returns:
thisassertion object
-
hasNoTraceLogs
Verifies that no trace logs were captured.- Returns:
thisassertion object
-