|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.testkit.EventFilter$
public class EventFilter$
Facilities for selectively filtering out expected events from logging so that you can keep your test run’s console output clean and do not miss real error messages.
'''Also have a look at the akka.testkit
package object’s filterEvents
and
filterException
methods.'''
The source filters do accept Class[_]
arguments, matching any
object which is an instance of the given class, e.g.
EventFilter.info(source = classOf[MyActor]) // will match Info events from any MyActor instance
The message object will be converted to a string before matching ("null"
if it is null
).
Field Summary | |
---|---|
static EventFilter$ |
MODULE$
Static reference to the singleton instance of this Scala object. |
Constructor Summary | |
---|---|
EventFilter$()
|
Method Summary | ||
---|---|---|
|
apply(java.lang.String message,
java.lang.String source,
java.lang.String start,
java.lang.String pattern,
int occurrences,
scala.reflect.ClassTag<A> evidence$1)
Create a filter for Error events. |
|
EventFilter |
custom(scala.PartialFunction<Logging.LogEvent,java.lang.Object> test,
int occurrences)
Create a custom event filter. |
|
EventFilter |
debug(java.lang.String message,
java.lang.String source,
java.lang.String start,
java.lang.String pattern,
int occurrences)
Create a filter for Debug events. |
|
EventFilter |
error(java.lang.String message,
java.lang.String source,
java.lang.String start,
java.lang.String pattern,
int occurrences)
Create a filter for Error events which do not have a cause set (i.e. |
|
EventFilter |
info(java.lang.String message,
java.lang.String source,
java.lang.String start,
java.lang.String pattern,
int occurrences)
Create a filter for Info events. |
|
EventFilter |
warning(java.lang.String message,
java.lang.String source,
java.lang.String start,
java.lang.String pattern,
int occurrences)
Create a filter for Warning events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final EventFilter$ MODULE$
Constructor Detail |
---|
public EventFilter$()
Method Detail |
---|
public <A extends java.lang.Throwable> EventFilter apply(java.lang.String message, java.lang.String source, java.lang.String start, java.lang.String pattern, int occurrences, scala.reflect.ClassTag<A> evidence$1)
start
and pattern
:
EventFilter[MyException]() // filter only on exception type
EventFilter[MyException]("message") // filter on exactly matching message
EventFilter[MyException](source = obj) // filter on event source
EventFilter[MyException](start = "Expected") // filter on start of message
EventFilter[MyException](source = obj, pattern = "weird.*message") // filter on pattern and message
''Please note that filtering on the source
being
null
does NOT work (passing null
disables the
source filter).''
message
- (undocumented)source
- (undocumented)start
- (undocumented)pattern
- (undocumented)occurrences
- (undocumented)evidence$1
- (undocumented)
public EventFilter error(java.lang.String message, java.lang.String source, java.lang.String start, java.lang.String pattern, int occurrences)
message
- (undocumented)source
- (undocumented)start
- (undocumented)pattern
- (undocumented)occurrences
- (undocumented)
public EventFilter warning(java.lang.String message, java.lang.String source, java.lang.String start, java.lang.String pattern, int occurrences)
start
and pattern
:
EventFilter.warning() // filter only on exception type
EventFilter.warning(source = obj) // filter on event source
EventFilter.warning(start = "Expected") // filter on start of message
EventFilter.warning(source = obj, pattern = "weird.*message") // filter on pattern and message
''Please note that filtering on the source
being
null
does NOT work (passing null
disables the
source filter).''
message
- (undocumented)source
- (undocumented)start
- (undocumented)pattern
- (undocumented)occurrences
- (undocumented)
public EventFilter info(java.lang.String message, java.lang.String source, java.lang.String start, java.lang.String pattern, int occurrences)
start
and pattern
:
EventFilter.info() // filter only on exception type
EventFilter.info(source = obj) // filter on event source
EventFilter.info(start = "Expected") // filter on start of message
EventFilter.info(source = obj, pattern = "weird.*message") // filter on pattern and message
''Please note that filtering on the source
being
null
does NOT work (passing null
disables the
source filter).''
message
- (undocumented)source
- (undocumented)start
- (undocumented)pattern
- (undocumented)occurrences
- (undocumented)
public EventFilter debug(java.lang.String message, java.lang.String source, java.lang.String start, java.lang.String pattern, int occurrences)
start
and pattern
:
EventFilter.debug() // filter only on exception type
EventFilter.debug(source = obj) // filter on event source
EventFilter.debug(start = "Expected") // filter on start of message
EventFilter.debug(source = obj, pattern = "weird.*message") // filter on pattern and message
''Please note that filtering on the source
being
null
does NOT work (passing null
disables the
source filter).''
message
- (undocumented)source
- (undocumented)start
- (undocumented)pattern
- (undocumented)occurrences
- (undocumented)
public EventFilter custom(scala.PartialFunction<Logging.LogEvent,java.lang.Object> test, int occurrences)
true
.
EventFilter.custom {
case Warning(ref, "my warning") if ref == actor || ref == null => true
}
test
- (undocumented)occurrences
- (undocumented)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |