1 package org.apache.lucene.facet.example;
5 import org.apache.lucene.util.LuceneTestCase;
6 import org.apache.lucene.facet.example.ExampleResult;
7 import org.apache.lucene.facet.example.adaptive.AdaptiveMain;
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed with
12 * this work for additional information regarding copyright ownership.
13 * The ASF licenses this file to You under the Apache License, Version 2.0
14 * (the "License"); you may not use this file except in compliance with
15 * the License. You may obtain a copy of the License at
17 * http://www.apache.org/licenses/LICENSE-2.0
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
27 * Test that the adaptive example works as expected. This test helps to verify
28 * that examples code is alive!
30 public class TestAdaptiveExample extends LuceneTestCase {
33 public void testAdaptive () throws Exception {
34 ExampleResult res = new AdaptiveMain().runSample();
35 assertNotNull("Null result!", res);
36 assertNotNull("Null facet result!", res.getFacetResults());
37 assertEquals("Wrong number of results!",1, res.getFacetResults().size());
38 assertEquals("Wrong number of facets!",3, res.getFacetResults().get(0).getNumValidDescendants());