01: package org.apache.lucene.queryParser.surround.query;
02:
03: /**
04: * Licensed to the Apache Software Foundation (ASF) under one or more
05: * contributor license agreements. See the NOTICE file distributed with
06: * this work for additional information regarding copyright ownership.
07: * The ASF licenses this file to You under the Apache License, Version 2.0
08: * (the "License"); you may not use this file except in compliance with
09: * the License. You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19:
20: import junit.framework.TestCase;
21: import junit.framework.TestSuite;
22: import junit.textui.TestRunner;
23:
24: public class Test01Exceptions extends TestCase {
25: /** Main for running test case by itself. */
26: public static void main(String args[]) {
27: TestRunner.run(new TestSuite(Test01Exceptions.class));
28: }
29:
30: boolean verbose = false; /* to show actual parsing error messages */
31: final String fieldName = "bi";
32:
33: String[] exceptionQueries = { "*", "a*", "ab*", "?", "a?", "ab?",
34: "a???b", "a?", "a*b?", "word1 word2", "word2 AND",
35: "word1 OR", "AND(word2)", "AND(word2,)",
36: "AND(word2,word1,)", "OR(word2)", "OR(word2 ,",
37: "OR(word2 , word1 ,)", "xx NOT", "xx (a AND b)",
38: "(a AND b", "a OR b)", "or(word2+ not ord+, and xyz,def)",
39: "" };
40:
41: public void test01Exceptions() throws Exception {
42: String m = ExceptionQueryTst.getFailQueries(exceptionQueries,
43: verbose);
44: if (m.length() > 0) {
45: fail("No ParseException for:\n" + m);
46: }
47: }
48: }
|