Permalink
Browse files

Tests for Term filter queries.

  • Loading branch information...
1 parent 75d6c4f commit 7a6eeaec0023a8d9356723c69ea0859d57410b09 @adamalix adamalix committed May 10, 2012
Showing with 12 additions and 12 deletions.
  1. +12 −12 src/test/scala/com/foursquare/slashem/ElasticQueryTest.scala
View
24 src/test/scala/com/foursquare/slashem/ElasticQueryTest.scala
@@ -347,18 +347,18 @@ class ElasticQueryTest extends SpecsMatchers with ScalaCheckMatchers {
}
@Test
- def testUnanalyzed {
- try {
- val res1 = ESimplePanda where (_.termsfield eqs "termhit") fetch()
- val res2 = ESimplePanda where (_.termsfield in List("randomterm", "termhit")) fetch()
- Assert.assertEquals(res1.response.results.length, 1)
- Assert.assertEquals(res2.response.results.length, 1)
- } catch {
- case e: Exception => {
- e.printStackTrace()
- Assert.fail
- }
- }
+ def testTermQueries {
+ val res1 = ESimplePanda where (_.termsfield eqs "termhit") fetch()
+ val res2 = ESimplePanda where (_.termsfield in List("randomterm", "termhit")) fetch()
+ Assert.assertEquals(res1.response.results.length, 1)
+ Assert.assertEquals(res2.response.results.length, 1)
+ }
+
+ @Test
+ def testTermFilters {
+ // grab 2 results, filter to 1
+ val res1 = ESimplePanda where (_.hugenums contains 1L) filter(_.termsfield in List("termhit", "randomterm")) fetch()
+ Assert.assertEquals(res1.response.results.length, 1)
}
@Before

0 comments on commit 7a6eeae

Please sign in to comment.