aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/query/test/PresentationTestCase.java
blob: 4aefd3c82e0b91c5c477eb58cfbeb84f6f188a77 (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
32
33
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.test;

import com.yahoo.prelude.query.Highlight;
import com.yahoo.search.Query;
import com.yahoo.search.query.Presentation;
import org.junit.jupiter.api.Test;

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

/**
 * @author Arne Bergene Fossaa
 */
public class PresentationTestCase {

    @Test
    void testClone() {
        Query q = new Query("");
        Presentation p = new Presentation(q);
        p.setBolding(true);
        Highlight h = new Highlight();
        h.addHighlightTerm("date", "today");
        p.setHighlight(h);
        Presentation pc = (Presentation) p.clone();
        h.addHighlightTerm("title", "Hello");
        assertTrue(pc.getBolding());
        pc.getHighlight().getHighlightItems();
        assertTrue(pc.getHighlight().getHighlightItems().containsKey("date"));
        assertFalse(pc.getHighlight().getHighlightItems().containsKey("title"));
        assertEquals(p, pc);
    }

}