Thank you for applying to Gatling Corp. We will use these small exercises in our hiring process.
Please code as you would do in your everyday work.
Create a "concat" method which takes 2 Option[String]
s and concatenate their contents when both exist.
def concat(opt1: Option[String],
opt2: Option[String]): Option[String] = ???
concat(Some("foo"), Some("bar")) // Some("foobar")
concat(Some("foo"), None) // None
concat(None, Some("bar")) // None
concat(None, None) // None
You can solve this in the file src/test/scala/io/gatling/ConcatSpec.scala
, which can be easily run with IntelliJ, or with Scala Metals on your favorite editor (ie: https://scalameta.org/metals/docs/editors/vscode/)
Or in your console:
./sbtx "testOnly io.gatling.ConcatSpec"
The goal of this part is to create a CRUD API of computers (just like our demo website: https://computer-database.gatling.io/computers).
The major libraries you'll need to use are:
You can find here the basis of the project, feel free to modify the architecture to your taste.
A computer is represented by:
- an id
- a name
- an optional introduced date
- an optional discontinued date
./sbtx run
There is already a first endpoint accessible at http://localhost:8086/computers
The API is not connected to a database, all read and insert are mocked.
- add an API to insert a computer
- modify the json output of a computer:
- it should not display null introduced or discontinued dates
- it should display the lifetime of a computer (period between discontinued and introduced)
- link every computer to a company (a company can manufacture multiple computers)