Skip to main content
summaryrefslogtreecommitdiffstats
blob: cfdc92a1245761f5e99265bd10a504fc735957b6 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*******************************************************************************
 * Copyright (c) 2010, 2016 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ua.tests.help.search;


import static org.junit.Assert.assertEquals;

import org.eclipse.help.internal.search.SearchHit;
import org.junit.Test;


public class SearchParticipantXMLTest {
	@Test
	public void testSearchFirstWordInFirstDoc() {
		SearchTestUtils.searchAllLocales("jfplepdl", new String[] { MockSearchParticipantXML.DOC_1 });
	}

	@Test
	public void testSearchLastWordInFirstDoc() {
		SearchTestUtils.searchAllLocales("memdjkemd", new String[] { MockSearchParticipantXML.DOC_1 });
	}

	@Test
	public void testSearchWordFromOuterElement() {
		SearchTestUtils.searchAllLocales("odoeofoedo", new String[] { MockSearchParticipantXML.DOC_2 });
	}

	@Test
	public void testSearchWordFromNestedElement() {
		SearchTestUtils.searchAllLocales("odkeofkeks", new String[] { MockSearchParticipantXML.DOC_2 });
	}

	@Test
	public void testReturnedTitle() {
		SearchHit[] hits = SearchTestUtils.getSearchHits("jfplepdl", "en");
		assertEquals(hits.length,1);
		assertEquals("Participant XML 1", hits[0].getLabel());
	}

	@Test
	public void testReturnedSummary() {
		SearchHit[] hits = SearchTestUtils.getSearchHits("jfplepdl", "en");
		assertEquals(hits.length,1);
		assertEquals("Summary for file Participant XML1", hits[0].getSummary());
	}

	@Test
	public void testReturnedTitleNestedCase() {
		SearchHit[] hits = SearchTestUtils.getSearchHits("odoeofoedo", "en");
		assertEquals(hits.length,1);
		assertEquals("Participant XML 2 - tests nesting", hits[0].getLabel());
	}

	@Test
	public void testReturnedSummaryNestedCase() {
		SearchHit[] hits = SearchTestUtils.getSearchHits("odoeofoedo", "en");
		assertEquals(hits.length,1);
		assertEquals("Summary for file Participant XML2", hits[0].getSummary());
	}

}

Back to the top