Package akka.testkit

Class ErrorFilter

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product, scala.Serializable

    public final class ErrorFilter
    extends EventFilter
    implements scala.Product, scala.Serializable
    Filter which matches Error events, if they satisfy the given criteria:
    • throwable applies an upper bound on the type of exception contained in the Error event
    • source, if given, applies a filter on the event’s origin
    • message applies a filter on the event’s message (either with String.startsWith or Regex.findFirstIn().isDefined); if the message itself does not match, the match is retried with the contained Exception’s message; if both are null, the filter always matches if at the same time the Exception’s stack trace is empty (this catches JVM-omitted “fast-throw” exceptions)
    If you want to match all Error events, the most efficient is to use Left("").
    See Also:
    Serialized Form
    • Constructor Detail

      • ErrorFilter

        public ErrorFilter​(java.lang.Class<?> throwable,
                           scala.Option<java.lang.String> source,
                           scala.util.Either<java.lang.String,​scala.util.matching.Regex> message,
                           boolean complete,
                           int occurrences)
      • ErrorFilter

        public ErrorFilter​(java.lang.Class<?> throwable,
                           java.lang.String source,
                           java.lang.String message,
                           boolean pattern,
                           boolean complete,
                           int occurrences)
        Java API: create an ErrorFilter

        Parameters:
        source - apply this filter only to events from the given source; do not filter on source if this is given as null
        message - apply this filter only to events whose message matches; do not filter on message if this is given as null
        pattern - if false, the message string must start with the given string, otherwise the message argument is treated as regular expression which is matched against the message (may match only a substring to filter)
        complete - whether the event&rsquo;s message must match the given message string or pattern completely
        throwable - (undocumented)
        occurrences - (undocumented)
      • ErrorFilter

        public ErrorFilter​(java.lang.Class<?> throwable)
        Java API: filter only on the given type of exception
        Parameters:
        throwable - (undocumented)
    • Method Detail

      • apply

        public static ErrorFilter apply​(java.lang.Class<?> throwable,
                                        scala.Option<java.lang.String> source,
                                        scala.util.Either<java.lang.String,​scala.util.matching.Regex> message,
                                        boolean complete,
                                        int occurrences)
      • unapply

        public static scala.Option<scala.Tuple4<java.lang.Class<?>,​scala.Option<java.lang.String>,​scala.util.Either<java.lang.String,​scala.util.matching.Regex>,​java.lang.Object>> unapply​(ErrorFilter x$0)
      • awaitDone

        public static boolean awaitDone​(scala.concurrent.duration.Duration max)
      • assertDone

        public static void assertDone​(scala.concurrent.duration.Duration max)
      • intercept

        public static <T> T intercept​(scala.Function0<T> code,
                                      ActorSystem system)
      • doMatch

        protected static boolean doMatch​(java.lang.String src,
                                         java.lang.Object msg)
      • throwable

        public java.lang.Class<?> throwable()
      • source

        public scala.Option<java.lang.String> source()
        Overrides:
        source in class EventFilter
      • message

        public scala.util.Either<java.lang.String,​scala.util.matching.Regex> message()
        Overrides:
        message in class EventFilter
      • matches

        public boolean matches​(Logging.LogEvent event)
        Description copied from class: EventFilter
        This method decides whether to filter the event (true) or not (false).
        Specified by:
        matches in class EventFilter
        Parameters:
        event - (undocumented)
        Returns:
        (undocumented)
      • copy

        public ErrorFilter copy​(java.lang.Class<?> throwable,
                                scala.Option<java.lang.String> source,
                                scala.util.Either<java.lang.String,​scala.util.matching.Regex> message,
                                boolean complete,
                                int occurrences)
      • copy$default$1

        public java.lang.Class<?> copy$default$1()
      • copy$default$2

        public scala.Option<java.lang.String> copy$default$2()
      • copy$default$3

        public scala.util.Either<java.lang.String,​scala.util.matching.Regex> copy$default$3()
      • copy$default$4

        public boolean copy$default$4()
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object