xref: /OpenGrok/suggester/src/test/java/org/opengrok/suggest/query/SuggesterRangeQueryTest.java (revision 2f7dccc7cd05ce1957006b093948d5359068ae4f)
1e8e40152SAdam Hornáček /*
2e8e40152SAdam Hornáček  * CDDL HEADER START
3e8e40152SAdam Hornáček  *
4e8e40152SAdam Hornáček  * The contents of this file are subject to the terms of the
5e8e40152SAdam Hornáček  * Common Development and Distribution License (the "License").
6e8e40152SAdam Hornáček  * You may not use this file except in compliance with the License.
7e8e40152SAdam Hornáček  *
8e8e40152SAdam Hornáček  * See LICENSE.txt included in this distribution for the specific
9e8e40152SAdam Hornáček  * language governing permissions and limitations under the License.
10e8e40152SAdam Hornáček  *
11e8e40152SAdam Hornáček  * When distributing Covered Code, include this CDDL HEADER in each
12e8e40152SAdam Hornáček  * file and include the License file at LICENSE.txt.
13e8e40152SAdam Hornáček  * If applicable, add the following below this CDDL HEADER, with the
14e8e40152SAdam Hornáček  * fields enclosed by brackets "[]" replaced with your own identifying
15e8e40152SAdam Hornáček  * information: Portions Copyright [yyyy] [name of copyright owner]
16e8e40152SAdam Hornáček  *
17e8e40152SAdam Hornáček  * CDDL HEADER END
18e8e40152SAdam Hornáček  */
19e8e40152SAdam Hornáček 
20e8e40152SAdam Hornáček /*
21*2f7dccc7SAdam Hornacek  * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
22e8e40152SAdam Hornáček  */
23e8e40152SAdam Hornáček package org.opengrok.suggest.query;
24e8e40152SAdam Hornáček 
25e8e40152SAdam Hornáček import org.apache.lucene.util.BytesRef;
267ef04fd1SAdam Hornacek import org.junit.jupiter.api.Test;
27e8e40152SAdam Hornáček 
287ef04fd1SAdam Hornacek import static org.junit.jupiter.api.Assertions.assertEquals;
29e8e40152SAdam Hornáček 
30e8e40152SAdam Hornáček public class SuggesterRangeQueryTest {
31e8e40152SAdam Hornáček 
32e8e40152SAdam Hornáček     @Test
testLengthLower()33e8e40152SAdam Hornáček     public void testLengthLower() {
34e8e40152SAdam Hornáček         SuggesterRangeQuery q = new SuggesterRangeQuery("test", new BytesRef("lowerTerm"), new BytesRef("upper"),
35e8e40152SAdam Hornáček                 true, false, SuggesterRangeQuery.SuggestPosition.LOWER);
36e8e40152SAdam Hornáček         assertEquals("lowerTerm".length(), q.length());
37e8e40152SAdam Hornáček     }
38e8e40152SAdam Hornáček 
39e8e40152SAdam Hornáček     @Test
testLengthUpper()40e8e40152SAdam Hornáček     public void testLengthUpper() {
41e8e40152SAdam Hornáček         SuggesterRangeQuery q = new SuggesterRangeQuery("test", new BytesRef("l"), new BytesRef("upper"),
42e8e40152SAdam Hornáček                 true, false, SuggesterRangeQuery.SuggestPosition.UPPER);
43e8e40152SAdam Hornáček         assertEquals("upper".length(), q.length());
44e8e40152SAdam Hornáček     }
45e8e40152SAdam Hornáček 
46e8e40152SAdam Hornáček }
47