aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/query/test/IntItemTestCase.java
blob: 052bb75679f12e0f3e26dcef3964448e80439a98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.query.test;

import com.yahoo.prelude.query.AndItem;
import com.yahoo.prelude.query.IntItem;
import com.yahoo.prelude.query.WeakAndItem;
import com.yahoo.search.Query;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * @author bratseth
 */
public class IntItemTestCase {

    @Test
    void testEquals() {
        Query q1 = new Query("/?query=123%20456%20789");
        Query q2 = new Query("/?query=123%20456");

        WeakAndItem andItem = (WeakAndItem) q2.getModel().getQueryTree().getRoot();
        var item = new IntItem(789L, "");
        item.setFromQuery(true);
        andItem.addItem(item);

        assertEquals(q1, q2);
    }

}