Create scala-extensions module for Scala 3 #1770
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a scala-extensions module for a Scala 3 DSL similar to the existing Kotlin DSL. This extension is important since rest-assured is heavily used in Quarkus tests for endpoints and goes along the Quickstart for Scala 3/Quarkus I've been working on.
There are some points of improvement that could be done before merging (I might need some help):
Then
always returns aValidatableResponse
so anExtract
could be chained. It would be great if it could returnUnit
in case there is noExtract
so there won't be the need to declare the testdef
return type asUnit
(to be picked-up by JUnit). I added aThenAssert
convenience method that usesThen
but returnsUnit
for simplified usage.Extract
method needs the type to be defined in theval/var
it's been assigned to. Don't know if there's a way around this.Extracting anSolved.Int
from json requires specifying the type as a JavaInteger
instead of a ScalaInt
. This generates the errorjava.lang.Exception: Unsupported type
.Let me know any additional requirements to have this in the main Rest-assured tree
This is based on the great work by @GavinRay97
There are a couple of Scala code in-tree that I'd like to hear some feedback on how to tackle. Should we keep this module in Scala 3 or should I rewrite in Scala 2.13?