I’m working on a customer-readable DSL for ScalaTest. At the moment I can write
feature("Admin Login") {
scenario("Correct username and password") {
given("user visits", classOf[AdminHomePage])
then(classOf[SignInPage], "is displayed")
but this would read a lot better as
feature("Admin Login") {
scenario("Correct username and password") {
given("user visits", the[AdminHomePage])
then(the[SignInPage], "is displayed")
Is there any way to
def the[T] =
to return classOf[T] ?
What you probably want to do is just rename the method (which is defined in the
Predefobject) on import:Note that classOf won’t work anymore if you rename it like this. If you still need it, also add this import:
For more renaming goodness see also: