blob: aafbeaf5825be40a16fdf303dbfeea115fec317f (
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
34
35
|
// 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.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author Arne Bergene Fossaa
*/
public class PresentationTestCase {
@Test
public 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);
}
}
|