All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.chopsticks.testkit.AkkaTestKit.scala Maven / Gradle / Ivy

There is a newer version: 3.12.0
Show newest version
package dev.chopsticks.testkit

import akka.actor.ActorSystem
import akka.testkit.TestKitBase
import com.typesafe.config.{Config, ConfigFactory}
import pureconfig.{KebabCase, PascalCase}

trait AkkaTestKit extends TestKitBase {
  lazy val typesafeConfig: Config = {
    val cfg = ConfigFactory.load()
    assert(
      cfg.getBoolean("akka.stream.materializer.debug.fuzzing-mode"),
      "akka.stream.materializer.debug.fuzzing-mode is not 'on' for testing, config loading is not working properly?"
    )
    cfg
  }

  implicit lazy val system: ActorSystem = ActorSystem(
    getClass.getName.split("\\.").map(n => KebabCase.fromTokens(PascalCase.toTokens(n))).mkString("-"),
    typesafeConfig
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy