java.lang.RuntimeException: There is no started application error, when testing a class from scala worksheet
<p>I wanted to test a class by running it from a scala worksheet. When running this test script:</p>

<pre><code>import ping.GcmRestServer

val server = new GcmRestServer("AIzaSyCOn...")
server.send(List("dcGKzDg5VOQ:APA91bHNUDaBj01th..."), Map(
  "message" -&gt; "Test Message",
  "title" -&gt; "Test Title"
))
</code></pre>

<p>Were the tested class GcmRestServer is</p>

<pre><code>package ping

import play.api.Logger
import play.api.libs.ws.WS
import play.api.libs.json.Json
/**
  * Created by Lukasz on 26.02.2016.
  */
class GcmRestServer(val key: String) {

  def send(ids: List[String], data: Map[String, String]) = {
    import play.api.Play.current
    import scala.concurrent.ExecutionContext.Implicits.global

    val body = Json.obj(
      "registration_ids" -&gt; ids,
      "data" -&gt; data
    )

    WS.url("https://android.googleapis.com/gcm/send")
      .withHeaders(
        "Authorization" -&gt; s"key=$key",
        "Content-type" -&gt; "application/json"
      )
      .post(body)
      .map { response =&gt; Logger.debug("Result: " + response.body)}
  }
}
</code></pre>

<p>Gives the following result:</p>

<pre><code>import ping.GcmRestServer

server: ping.GcmRestServer = ping.GcmRestServer@34860db2
java.lang.RuntimeException: There is no started application
    at scala.sys.package$.error(test.sc2.tmp:23)
    at play.api.Play$$anonfun$current$1.apply(test.sc2.tmp:82)
    at play.api.Play$$anonfun$current$1.apply(test.sc2.tmp:82)
    at scala.Option.getOrElse(test.sc2.tmp:117)
    at play.api.Play$.current(test.sc2.tmp:82)
    at ping.GcmRestServer.send(test.sc2.tmp:16)
    at #worksheet#.get$$instance$$res0(test.sc2.tmp:4)
    at #worksheet#.#worksheet#(test.sc2.tmp:19)
</code></pre>

<p>Could somebody explain me what I did wrong, and how to fix this?</p>