|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<ch.qos.logback.classic.spi.ILoggingEvent>
com.codereligion.cherry.test.hamcrest.logback.LoggingEventLoggedBy
public class LoggingEventLoggedBy
A matcher which expects the ILoggingEvent to have a specific loggerName
| Method Summary | |
|---|---|
protected void |
describeExpectation(org.hamcrest.Description description)
Describes the expected data. |
protected void |
describeMismatchSafely(ch.qos.logback.classic.spi.ILoggingEvent item,
org.hamcrest.Description mismatchDescription)
|
protected void |
describeNegatedExpectation(org.hamcrest.Description description)
Describes the expected data when the matcher has been negated. |
void |
describeTo(org.hamcrest.Description description)
|
protected boolean |
internalMatches(ch.qos.logback.classic.spi.ILoggingEvent event)
This method must return true when the given event matches. |
static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> |
loggedBy(Class<?> loggerType)
Creates a new matcher for ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the name of the given class. |
static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> |
loggedBy(String loggerName)
Creates a new matcher for ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the given one. |
boolean |
matchesSafely(ch.qos.logback.classic.spi.ILoggingEvent event)
|
static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> |
wasLoggedBy(Class<?> loggerType)
Creates a new matcher for ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the name of the given class. |
static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> |
wasLoggedBy(String loggerName)
Creates a new matcher for ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the given one. |
static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> |
wasNotLoggedBy(Class<?> loggerType)
Creates a new matcher for ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is not equal to the name of the given class. |
static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> |
wasNotLoggedBy(String loggerName)
Creates a new matcher for ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is not equal to the given one. |
| Methods inherited from class org.hamcrest.TypeSafeMatcher |
|---|
describeMismatch, matches |
| Methods inherited from class org.hamcrest.BaseMatcher |
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> wasLoggedBy(String loggerName)
ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the given one. This matcher is doing the same assertion as loggedBy(String), with the
difference that this matcher's output is optimized for usage on single events.
Example usage: assertThat(event, wasLoggedBy("SomeLogger"));
Example output: Expected: an ILoggingEvent logged by: SomeLogger but: was ILoggingEvent{level=ERROR, formattedMessage='some Message',
loggedBy=SomeOtherLogger, throwable=null}
loggerName - the name of the loggerName to match the event's logger with
IllegalArgumentException - when the given parameter is nullpublic static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> wasNotLoggedBy(String loggerName)
ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is not equal to the given one. This matcher is the negation of wasLoggedBy(String). It is
recommended to use this specific matcher instead of just combining the other matcher with CoreMatchers.not(Matcher) because of the
improved error output.
Example usage: assertThat(event, wasNotLoggedBy("SomeLogger"));
Example output: Expected: an ILoggingEvent not logged by: SomeLogger but: was ILoggingEvent{level=ERROR, formattedMessage='some Message',
loggedBy=SomeLogger, throwable=null}
loggerName - the name of the loggerName to match the event's logger with
IllegalArgumentException - when the given parameter is nullpublic static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> loggedBy(String loggerName)
ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the given one. This matcher is doing the same assertion as wasLoggedBy(String), with
the difference that this matcher's output is optimized for usage on iterables of events.
Example usage: assertThat(events, hasItem(loggedBy("SomeLogger")));
Example output: Expected: an iterable containing an ILoggingEvent logged by: SomeLogger but: iterable contained [ILoggingEvent{level=INFO,
formattedMessage='some Message', loggedBy=SomeOtherLogger, throwable=null}]
loggerName - the name of the loggerName to match the event's logger with
IllegalArgumentException - when the given parameter is nullpublic static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> wasLoggedBy(Class<?> loggerType)
ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the name of the given class. This matcher is doing the same assertion as loggedBy(Class), with the difference that this matcher's output is optimized for usage on single events.
Example usage: assertThat(event, wasLoggedBy(SomeType.class));
Example output: Expected: an ILoggingEvent logged by: SomeType but: was ILoggingEvent{level=ERROR, formattedMessage='some Message',
loggedBy=SomeOtherLogger, throwable=null}
loggerType - the Class of which the name will be used to match the event's logger with
IllegalArgumentException - when the given parameter is nullpublic static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> wasNotLoggedBy(Class<?> loggerType)
ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is not equal to the name of the given class. This matcher is the negation of wasLoggedBy(Class). It
is recommended to use this specific matcher instead of just combining the other matcher with CoreMatchers.not(Matcher) because of
the improved error output.
Example usage: assertThat(event, wasNotLoggedBy(SomeType.class));
Example output: Expected: an ILoggingEvent not logged by: SomeType but: was ILoggingEvent{level=ERROR, formattedMessage='some Message',
loggedBy=SomeType, throwable=null}
loggerType - the Class of which the name will be used to match the event's logger with
IllegalArgumentException - when the given parameter is nullpublic static org.hamcrest.Matcher<ch.qos.logback.classic.spi.ILoggingEvent> loggedBy(Class<?> loggerType)
ILoggingEvents that only matches when the examined event was logged by a
logger of which the name is equal to the name of the given class. This matcher is doing the same assertion as wasLoggedBy(Class), with the difference that this matcher's output is optimized for usage on iterables of events.
Example usage: assertThat(events, hasItem(loggedBy(SomeType.class)));
Example output: Expected: an iterable containing an ILoggingEvent logged by: SomeType but: iterable contained [ILoggingEvent{level=INFO,
formattedMessage='some Message', loggedBy=SomeOtherLogger, throwable=null}]
loggerType - the Class of which the name will be used to match the event's logger with
IllegalArgumentException - when the given parameter is nullprotected boolean internalMatches(ch.qos.logback.classic.spi.ILoggingEvent event)
event matches. Proper negation is handled by the caller of this method.
event - the ILoggingEvent to be checked
true if the event matchesprotected void describeExpectation(org.hamcrest.Description description)
description - the Description to amend the textprotected void describeNegatedExpectation(org.hamcrest.Description description)
description - the Description to amend the textpublic boolean matchesSafely(ch.qos.logback.classic.spi.ILoggingEvent event)
matchesSafely in class org.hamcrest.TypeSafeMatcher<ch.qos.logback.classic.spi.ILoggingEvent>public void describeTo(org.hamcrest.Description description)
protected void describeMismatchSafely(ch.qos.logback.classic.spi.ILoggingEvent item,
org.hamcrest.Description mismatchDescription)
describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<ch.qos.logback.classic.spi.ILoggingEvent>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||