score:29
Accepted answer
You could use Props
like this:
val actorRef = TestActorRef(Props(new MyActor(param1, param2)))
Or factory method like this:
val actorRef = TestActorRef(new MyActor(param1, param2))
See apply
methods in object TestActorRef
.
Source: stackoverflow.com
Related Query
- How do I create a TestActorRef in Scala for an Actor with constructor params?
- How to create a TestActorRef inside a test class for an Actor with constructor params?
- How to create a Scala class with private field with public getter, and primary constructor taking a parameter of the same name
- How to create DSL in Scala for command lines with minimum extra boilerplate
- How to create a singleton object in Scala with runtime params
- How do I create horizontal or vertical struts and glue for use with scala BoxPanel?
- How to supply transformed params to superclass constructor while avoiding inline computations with Scala
- How to create param for superclass constructor without early initialiser in Scala
- How to create docker images for a scala multi project with sub projects
- Scala - How to create a class with a constructor that receives an object as parameter
- How to create a new column for dataset using ".withColumn" with many conditions in Scala Spark
- How to load 100 million records into MongoDB with Scala for performance testing?
- How do I find the correct Maven archetype project for developing with Scala in Eclipse?
- Does extending a class in scala with constructor params add vals (fields) to the class?
- How can I use JMH for Scala benchmarks together with sbt?
- How do you create scala anonymous function with multiple implicit parameters
- re-run with -feature for details, How to see scala feature warnings when building with gradle?
- Scala spark: how to use dataset for a case class with the schema has snake_case?
- How to create a general method for Scala 3 enums
- How do I add a no-arg constructor to a Scala case class with a macro annotation?
- Functor Instance for Type Constructor with Two Parameters in Scala
- How can I create an instance of a Case Class with constructor arguments with no Parameters in Scala?
- How to recognize scala constructor parameter 'fields' with no underlying java field?
- How to make a scala actor 'wait for the signal' but don't loose any messages?
- How to create new instance of Scala class with context bound via Java reflection using only zero argument constructor?
- How can I get random data generated for scala case classes with the ability to "change some values" for unit testing?
- How to create an Encoder for Scala collection (to implement custom Aggregator)?
- How do I write a scala extractor for a case class with default parameters?
- how to extend (or proxy) a scala class with private constructor
- How to create variables with macros in Scala
More Query from same tag
- Multidimensional Array zip array in scala
- Error connecting to databricks in python with databricks-connect
- Unable to import cosmosDB packages in spark-shell
- Custom spray json format of Either[TimeSlot,DateSlot] stuck in some kind of type-inference loop
- How to guard against repeated request?
- Excel Having issues with an ODS file created with SODS
- How to extract efficiently multiple columns from a single string column RDD?
- curly braces and parentheses for scala map
- simple exercise of subclass in Scala
- Scala : How to check every single digit of a number is even or odd?
- Can spark-submit with named argument?
- ClassNotFoundException: com.mongodb.spark.rdd.partitioner.MongoPartition
- how would i compile and execute a java program in a scala program?
- Binary searching via bitmasking?
- Finding the execution time of each step of a Spark stage
- How to use pipeTo in AKKA correctly
- Method and function declaration
- Dealing with errors using idiomatic Scala
- how to calculate factorial of list using higher order function in scala
- Idea + Play Framework - cannot resolve method/symbol
- How to create a Row from a List or Array in Spark using Scala
- What is the extra _ in this code sample from the Scala with Cats book?
- Write the function `selfApp` in book *Types and Programming Languages* in scala
- Rotation of a matrix in Scala without using a 2 dimensional Array
- Spark task optimisation
- Changing max node capacity in M-tree affects the results
- Scala How can Trait override toString Case Class that is Derived Off
- sSpark structured streaming PostgreSQL updatestatebykey
- Function to Accept Any Type but `AnyVal`?
- Spark Dataframe - Encoder