DATAMONGO-299 - Adding tests ensuring exception alert for multiple conditions for same key.
This commit is contained in:
committed by
Oliver Gierke
parent
71e639402c
commit
6cd3b7a3aa
@@ -18,6 +18,7 @@ package org.springframework.data.mongodb.core.query;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.mongodb.InvalidMongoDbApiUsageException;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
@@ -51,4 +52,10 @@ public class CriteriaTests {
|
||||
Criteria c = new Criteria("name").is("Bubba").and("age").lt(21);
|
||||
assertEquals("{ \"name\" : \"Bubba\" , \"age\" : { \"$lt\" : 21}}", c.getCriteriaObject().toString());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidMongoDbApiUsageException.class)
|
||||
public void testCriteriaWithMultipleConditionsForSameKey() {
|
||||
Criteria c = new Criteria("name").gte("M").and("name").ne("A");
|
||||
c.getCriteriaObject();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user