mirror of https://github.com/apache/lucene.git
throw IllegalArgumentExeception if value doesn't make sense
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@332762 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
11866ad09d
commit
7017c1b701
|
@ -63,6 +63,8 @@ public class BooleanQuery extends Query {
|
|||
* the operating system.
|
||||
*/
|
||||
public static void setMaxClauseCount(int maxClauseCount) {
|
||||
if (maxClauseCount < 1)
|
||||
throw new IllegalArgumentException("maxClauseCount must be >= 1");
|
||||
BooleanQuery.maxClauseCount = maxClauseCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import junit.framework.TestCase;
|
|||
import org.apache.lucene.index.Term;
|
||||
|
||||
public class TestBooleanQuery extends TestCase {
|
||||
|
||||
public void testEquality() throws Exception {
|
||||
BooleanQuery bq1 = new BooleanQuery();
|
||||
bq1.add(new TermQuery(new Term("field", "value1")), BooleanClause.Occur.SHOULD);
|
||||
|
@ -39,4 +40,14 @@ public class TestBooleanQuery extends TestCase {
|
|||
|
||||
assertEquals(bq1, bq2);
|
||||
}
|
||||
|
||||
public void testException() {
|
||||
try {
|
||||
BooleanQuery.setMaxClauseCount(0);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
// okay
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue