aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/query/test/DotProductItemTestCase.java
blob: dc376ff5fd02a7de01f362ee8476b4dfd231501e (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
31
// 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 org.junit.jupiter.api.Test;
import com.yahoo.prelude.query.*;

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

/**
 * @author havardpe
 */
public class DotProductItemTestCase {

    @Test
    void testDotProductItem() {
        DotProductItem item = new DotProductItem("index_name");
        assertEquals("index_name", item.getIndexName());
        assertEquals(Item.ItemType.DOTPRODUCT, item.getItemType());
    }

    @Test
    void testDotProductClone() {
        DotProductItem dpOrig = new DotProductItem("myDP");
        dpOrig.addToken("first", 11);
        dpOrig.getTokens();
        DotProductItem dpClone = (DotProductItem) dpOrig.clone();
        dpClone.addToken("second", 22);
        assertEquals(2, dpClone.getNumTokens());
    }

}