Created
February 14, 2013 21:41
-
-
Save jcheype/4956650 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.jcheype.webServer.scala | |
| import org.scalatest.{BeforeAndAfter, FunSuite} | |
| import org.apache.http.client.methods.HttpGet | |
| import org.apache.http.HttpResponse | |
| import org.apache.http.impl.client.DefaultHttpClient | |
| import org.scalatest.matchers.ShouldMatchers | |
| /** | |
| * Created with IntelliJ IDEA. | |
| * User: juliencheype | |
| * Date: 31/5/13 | |
| * Time: 22:34 | |
| */ | |
| class RestSimpleTest extends FunSuite with BeforeAndAfter with ShouldMatchers with RestSimple{ | |
| val httpclient:DefaultHttpClient = new DefaultHttpClient | |
| before { | |
| RestSimple.start(9999, this) | |
| } | |
| test("webserver test"){ | |
| val httpGet:HttpGet = new HttpGet("http://localhost:9999/test") | |
| val response:HttpResponse = httpclient.execute(httpGet) | |
| val status = response.getStatusLine.getStatusCode | |
| status should be === (200) | |
| } | |
| get("/test"){ | |
| response.write("hello") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment