1 package org.apache.lucene;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 import java.io.Reader;
22 import org.apache.lucene.util.LuceneTestCase;
23 import org.apache.lucene.analysis.Analyzer;
24 import org.apache.lucene.analysis.TokenStream;
26 public class TestAssertions extends LuceneTestCase {
28 static class TestAnalyzer1 extends Analyzer {
30 public final TokenStream tokenStream(String s, Reader r) { return null; }
32 public final TokenStream reusableTokenStream(String s, Reader r) { return null; }
35 static final class TestAnalyzer2 extends Analyzer {
37 public TokenStream tokenStream(String s, Reader r) { return null; }
39 public TokenStream reusableTokenStream(String s, Reader r) { return null; }
42 static class TestAnalyzer3 extends Analyzer {
44 public TokenStream tokenStream(String s, Reader r) { return null; }
46 public TokenStream reusableTokenStream(String s, Reader r) { return null; }
49 static class TestAnalyzer4 extends Analyzer {
51 public final TokenStream tokenStream(String s, Reader r) { return null; }
53 public TokenStream reusableTokenStream(String s, Reader r) { return null; }
56 static class TestTokenStream1 extends TokenStream {
58 public final boolean incrementToken() { return false; }
61 static final class TestTokenStream2 extends TokenStream {
63 public boolean incrementToken() { return false; }
66 static class TestTokenStream3 extends TokenStream {
68 public boolean incrementToken() { return false; }
71 public void testTokenStreams() {
76 boolean doFail = false;
80 } catch (AssertionError e) {
83 assertFalse("TestAnalyzer3 should fail assertion", doFail);
88 } catch (AssertionError e) {
91 assertFalse("TestAnalyzer4 should fail assertion", doFail);
93 new TestTokenStream1();
95 new TestTokenStream2();
98 new TestTokenStream3();
100 } catch (AssertionError e) {
103 assertFalse("TestTokenStream3 should fail assertion", doFail);