Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create scala-extensions module for Scala 3 #1770

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

carlosedp
Copy link

@carlosedp carlosedp commented Feb 5, 2024

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):

  • The method Then always returns a ValidatableResponse so an Extract could be chained. It would be great if it could return Unit in case there is no Extract so there won't be the need to declare the test def return type as Unit (to be picked-up by JUnit). I added a ThenAssert convenience method that uses Then but returns Unit for simplified usage.
  • The Extract method needs the type to be defined in the val/var it's been assigned to. Don't know if there's a way around this.
  • Extracting an Int from json requires specifying the type as a Java Integer instead of a Scala Int. This generates the error java.lang.Exception: Unsupported type. Solved.

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?

  • Deprecate scala-support module?
  • Update examples/scala-example
  • Update examples/scala-mock-mvc-example
  • Update examples/scalatra-example
  • Update examples/scalatra-webapp

@carlosedp
Copy link
Author

Latest push cleans-up some redundancy and fixes a couple of errors.
Tests and functionality are pretty much aligned with Kotlin module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant