Category "scala"

private[this] vs private

In Scala I see such feature as object-private variable. From my not very rich Java background I learnt to close everything (make it private) and open (provide a

How to use BehaviorTestKit to verify the right child was spawned

I'm trying to test determine that my actor spawned a child with the right parameters. There is testKit.expectEffect(Spawned(behavior,name,props)) But it's i

Gatling Websocket react on message

Is it possible to write a gatling script which connects to WebSocket and then performs actions (e.g. new HTTP requests) when certain messages are received (pref

TestNG Cannot find class in classpath once a new scala class is added to the suite.xml file

Seems like this is a very "popular" question on SO with no definitive way to fix it but I'm asking the question anyway because I can provide some more details.

Marshalling java.util.Date with SprayJson

I am new to Scala and Akka. I have the following case class: case class Demo(userId: String, date: java.util.Date, message: String) extends BusinessModel

Writing unit tests for tapir endpoints (API Layer) in scala

I have created tapir endpoints in scala, where the architecture of the project is such that API layer calls service layer and service layer calls repo layer. I

Scala collectFirst with function returning Option[U]

I've had this situation occur a number of times in the library I'm writing, and I'm not particularly satisfied with the solutions I've come up with so far. Let

object.type does not take parameter error

Following is the code snippet I am using from play with scala book. It works well in the framework but when I try in the commndline it gives the error error:

Gatling load testing and running scenarios

I am looking to create three scenarios: The first scenario will run a bunch of GET requests for 30s The second and third scenarios will run in parallel and wait

How do we do Spark Dataframe testing using JUnit?

We are trying to build an integration test suite using JUnit. Our pipeline (built in Spark using Scala) gives us DataFrames as output, we plan to compare them a

Failed to build request: No attribute named 'token' is defined in Gatling script

I convert HAR file to Gatling simulations script, but I have problem with extracting token from request header. After conversion I have the following code: impo

Apache Arrow in Scala: AbstractMethodError on loadBatch

I'm trying to load Arrow file into scala. But every time I call ethier arrowStreamReader.loadNextBatch() nor arrowFileReader.loadRecordBatch(arrowBlock), the JV

Get item in the list in Scala?

How in the world do you get just an element at index i from the List in scala? I tried get(i), and [i] - nothing works. Googling only returns how to "find" an

IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified

I got the error "IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified" while running my scala project in pl

Multidimensional Array zip array in scala

I have two array like: val one = Array(1, 2, 3, 4) val two = Array(4, 5, 6, 7) var three = one zip two map{case(a, b) => a * b} It's ok. But I have a multid

Scala: grouped from right?

In Scala, grouped works from left to right. val list = List(1,2,3,4,5) list.grouped(2).toList => List[List[Int]] = List(List(1, 2), List(3, 4), List(5)) B

How to use a Scala class inside Pyspark

I've been searching for a while if there is any way to use a Scala class in Pyspark, and I haven't found any documentation nor guide about this subject. Let's

IntelliJ Scala so slow on fast CPU with 32GB ram

I am using IntelliJ 2019.1.3 Community Edition. In Scala compile server, JVM maximum heap size: 4096 my idea.vmoptions: -Xms4096m -Xmx6144m -XX:ReservedCodeCac