~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to lucene/contrib/facet/src/test/org/apache/lucene/facet/index/attributes/CategoryAttributesIterableTest.java

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.apache.lucene.facet.index.attributes;
2
 
 
3
 
import java.io.IOException;
4
 
import java.util.ArrayList;
5
 
import java.util.Iterator;
6
 
import java.util.List;
7
 
 
8
 
import org.junit.Test;
9
 
 
10
 
import org.apache.lucene.facet.index.CategoryContainerTestBase;
11
 
import org.apache.lucene.facet.index.attributes.CategoryAttribute;
12
 
import org.apache.lucene.facet.index.attributes.CategoryAttributesIterable;
13
 
import org.apache.lucene.facet.taxonomy.CategoryPath;
14
 
 
15
 
/**
16
 
 * Licensed to the Apache Software Foundation (ASF) under one or more
17
 
 * contributor license agreements.  See the NOTICE file distributed with
18
 
 * this work for additional information regarding copyright ownership.
19
 
 * The ASF licenses this file to You under the Apache License, Version 2.0
20
 
 * (the "License"); you may not use this file except in compliance with
21
 
 * the License.  You may obtain a copy of the License at
22
 
 *
23
 
 *     http://www.apache.org/licenses/LICENSE-2.0
24
 
 *
25
 
 * Unless required by applicable law or agreed to in writing, software
26
 
 * distributed under the License is distributed on an "AS IS" BASIS,
27
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
 
 * See the License for the specific language governing permissions and
29
 
 * limitations under the License.
30
 
 */
31
 
 
32
 
public class CategoryAttributesIterableTest extends CategoryContainerTestBase {
33
 
 
34
 
  @Test
35
 
  public void testIterator() throws IOException {
36
 
    List<CategoryPath> categoryList = new ArrayList<CategoryPath>();
37
 
    for (int i = 0; i < initialCatgeories.length; i++) {
38
 
      categoryList.add(initialCatgeories[i]);
39
 
    }
40
 
 
41
 
    CategoryAttributesIterable iterable = new CategoryAttributesIterable(
42
 
        categoryList);
43
 
    Iterator<CategoryAttribute> iterator = iterable.iterator();
44
 
 
45
 
    // count the number of tokens
46
 
    int nCategories;
47
 
    for (nCategories = 0; iterator.hasNext(); nCategories++) {
48
 
      iterator.next();
49
 
    }
50
 
    assertEquals("Wrong number of tokens", 3, nCategories);
51
 
  }
52
 
 
53
 
}