Skip to content

Instantly share code, notes, and snippets.

@hanrw
Created October 27, 2014 08:20
Show Gist options
  • Save hanrw/6a8721276138272107cb to your computer and use it in GitHub Desktop.
Save hanrw/6a8721276138272107cb to your computer and use it in GitHub Desktop.
ScalaMocoTest
import com.github.nicholasren.moco.dsl.Conversions._
import com.github.nicholasren.moco.dsl.SMoco
import com.github.nicholasren.moco.dsl.SMoco._
import org.apache.http.client.fluent.Request
import org.scalatest.{BeforeAndAfter, FunSpec}
class ScalaMocoTest extends FunSpec with BeforeAndAfter {
var theServer: SMoco = null
before {
theServer = server(8983)
}
after {
theServer = null
}
describe("solr responses") {
it("should return ok") {
theServer when {
uri("/solr/collection1/select")
} then {
file("/test.json")
}
theServer running {
val content = Request.Get("http://localhost:8983/solr/collection1/select").execute().returnContent()
assert(content.toString.contains("\"numFound\""))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment