Browse files

Add test for empty nin/in queries.

  • Loading branch information...
1 parent 3fb6928 commit 003122aebcf99753f05a626b48bf7b870ff348d7 @holdenk holdenk committed with adamalix May 7, 2012
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/test/scala/com/foursquare/slashem/QueryTest.scala
View
21 src/test/scala/com/foursquare/slashem/QueryTest.scala
@@ -70,6 +70,27 @@ class QueryTest extends SpecsMatchers with ScalaCheckMatchers {
}
@Test
+ def testProduceCorrectListfieldQueryStringWhenEmpty {
+ val q = SVenueTest where (_.commentList in List())
+ val qp = q.meta.queryParams(q).toList
+ Assert.assertEquals(qp.sortWith(_._1 > _._1),
+ List("q" -> "commentList:(\"\")",
+ "start" -> "0",
+ "rows" -> "10").sortWith(_._1 > _._1))
+ }
+ @Test
+ def testProduceCorrectListfieldQueryStringNinWhenEmpty {
+ val q = SVenueTest where (_.commentList nin List())
+ val qp = q.meta.queryParams(q).toList
+ Assert.assertEquals(qp.sortWith(_._1 > _._1),
+ List("q" -> "(*:* -commentList:(\"\"))",
+ "start" -> "0",
+ "rows" -> "10").sortWith(_._1 > _._1))
+ }
+
+
+
+ @Test
def testProduceCorrectSimpleQueryStringContains {
val q = SUserTest where (_.fullname contains "jon")
val qp = q.meta.queryParams(q).toList

0 comments on commit 003122a

Please sign in to comment.