Skip to content
Browse files

#1986 - Adding Java API constructors for Mute/UnMute

  • Loading branch information...
1 parent 1f30be1 commit 6cfe768d03dd26db900130518d67fd624403239d @viktorklang viktorklang committed Apr 25, 2012
Showing with 14 additions and 2 deletions.
  1. +14 −2 akka-testkit/src/main/scala/akka/testkit/TestEventListener.scala
View
16 akka-testkit/src/main/scala/akka/testkit/TestEventListener.scala
@@ -8,6 +8,8 @@ import akka.actor.{ DeadLetter, ActorSystem, Terminated, UnhandledMessage }
import akka.dispatch.{ SystemMessage, Terminate }
import akka.event.Logging.{ Warning, LogEvent, InitializeLogger, Info, Error, Debug, LoggerInitialized }
import akka.event.Logging
+import java.lang.{ Iterable JIterable }
+import scala.collection.JavaConverters
import akka.util.Duration
/**
@@ -34,11 +36,21 @@ object TestEvent {
object Mute {
def apply(filter: EventFilter, filters: EventFilter*): Mute = new Mute(filter +: filters.toSeq)
}
- case class Mute(filters: Seq[EventFilter]) extends TestEvent
+ case class Mute(filters: Seq[EventFilter]) extends TestEvent {
+ /**
+ * Java API
+ */
+ def this(filters: JIterable[EventFilter]) = this(JavaConverters.iterableAsScalaIterableConverter(filters).asScala.toSeq)
+ }
object UnMute {
def apply(filter: EventFilter, filters: EventFilter*): UnMute = new UnMute(filter +: filters.toSeq)
}
- case class UnMute(filters: Seq[EventFilter]) extends TestEvent
+ case class UnMute(filters: Seq[EventFilter]) extends TestEvent {
+ /**
+ * Java API
+ */
+ def this(filters: JIterable[EventFilter]) = this(JavaConverters.iterableAsScalaIterableConverter(filters).asScala.toSeq)
+ }
}
/**

1 comment on commit 6cfe768

@bantonsson
Akka Project member

+1

Please sign in to comment.
Something went wrong with that request. Please try again.