Use a proper DI technique such as Cake (or even in simpler cases constructor parameter injection) and you have control over things that need to be done differently or take variant forms during testing.
As a heuristic, depending on where you make that call, you can probably fill-in a stacktrace exception and check if a specs2 method gets executed.
- How can you see if your code is running in test mode with specs2?
- How to parse placeholders from text without throwing away your sword so you can fight off the marauders with a lampshade
- With Scala 2.10.2, SBT 0.13.0, Specs2 & Play Framework 2.2.1 how can I control logging whilst running tests?
- How can I pass JVM options to SBT to use when running the app or test cases?
- How can I see in what [Java/Scala?] code does Scala compiler rewrites original Scala-code
- How can I roll back an integration test with Slick 3 + Specs2?
- How can I use a combination of Scala, Groovy, and Java code with Gradle?
- How can i skip a test in specs2 without matchers?
- How can I test Java programs with ScalaCheck?
- How can you make custom function types in Scala with named parameters?
- Can you capture and inspect arguments supplied to a method under test with ScalaMock?
- Play2: How to do execute piece of code before each test using specs2
- How can you efficiently build one ML model per partition in Spark with foreachPartition?
- How can you sign a POST with OAuth1.0a using scala play?
- In Scala.js, how can code detect whether it is running in a browser window or a WebWorker?
- How to read resources in test code with Play Framework?
- Can I test Java controllers with specs2 in Play Framework 2?
- How can I run code locally with dependencies and exclude them when creating a Jar with Maven
- Play Framework Enumerator : How can you zip enumerator with Index
- how to run scalding test in local mode with local input file
- Site where you can submit your Scala code and have it reviewed
- How can I test a method which calls error() with specs2?
- How can I test future failure in a TestSuite with utest?
- How to test snippet code in liftweb using specs2 framework
- How can I use the Scala REPL to test java code - java and scala REPL giving different outputs
- How to create new commands that you can run after running the sbt command Scala
- How can you interface a JavaFX application running on iOS or Android to native libraries?
- How to load all app resources so that you can interact with existing code?
- How can a mill task update environment variables so that later running tasks will see the updated value?
- In SBT how can you write code that executes on initialization
More Query from same tag
- Scala parsing string to case object
- Map a variable of type of Pair -- impossible
- What is the significant difference with parenthesis when using function parameters
- Distribute the value of a Spark Dataframe row proportionately to other rows
- Are variables objects in Scala?
- Using Java 8 in Scala 2.11
- Akka warning about "Too many HashedWheelTimer instances"
- Spark Scala: How to pass column name in UDF with DataFrame.Select
- How to list all fields with a custom annotation using Scala's reflection at runtime?
- Consume TCP stream and redirect it to another Sink (with Akka Streams)
- Scala - infer type parameters
- Can I read all versions of one cell in cassandra?
- Lost in the inheritance graph of Scala's collections
- Scala 3 with ScalaFX thread related problem
- Replace seperator in Array[long] in the Spark dataframe
- Why spark.read.parquet() runs 2 jobs?
- Spark need an RDD.take with a big argument. Result should be an RDD
- Problems returning a value while using a trait and companion object in Scala (Eclipse IDE)
- Debunking Scala myths
- UDF's vs Spark sql vs column expressions performance optimization
- Gatling: while script execution getting error, "could not prepare: Boon failed to parse into a valid AST: -1"
- How can I safely process routing requests concurrently in spray.routing?
- Play WS OAuth content length required
- Correct Resolver for Akka Based Projects
- In graphX, how to partition a graph with a custom PartitionStrategy that makes use of its topology?
- Cannot use primary constructor in Scala method: type "does not take parameters"
- How to build a simple spark-test-app.jar to test AWS SageMaker SparkJarProcessing
- scala - map.get returns None for null key but not for null value
- multiple calculation in window function
- Scala reduce on Point class