pekko/akka-actor-tests/src/test/scala/akka/dispatch/ExecutionContextSpec.scala

34 lines
1 KiB
Scala
Raw Normal View History

2012-02-16 17:28:31 +01:00
package akka.dispatch
import akka.testkit.AkkaSpec
import akka.testkit.DefaultTimeout
import java.util.concurrent.{ ExecutorService, Executor, Executors }
import scala.concurrent.ExecutionContext
2012-02-16 17:28:31 +01:00
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
"An ExecutionContext" must {
"be instantiable" in {
val es = Executors.newCachedThreadPool()
try {
val executor: Executor with ExecutionContext = ExecutionContext.fromExecutor(es)
executor must not be (null)
val executorService: ExecutorService with ExecutionContext = ExecutionContext.fromExecutorService(es)
executorService must not be (null)
/*val jExecutor: ExecutionContextExecutor = ExecutionContext.fromExecutor(es)
2012-02-16 17:28:31 +01:00
jExecutor must not be (null)
val jExecutorService: ExecutionContextExecutorService = ExecutionContexts.fromExecutorService(es)
jExecutorService must not be (null)
*/
2012-02-16 17:28:31 +01:00
} finally {
es.shutdown
}
}
}
}