Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 181c3644e506323c302dec772e2c4003347e3840 (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
70
/*******************************************************************************
 * Copyright (c) 2010 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 org.eclipse.help.internal.search.SearchHit;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;


public class SearchParticipantXMLTest extends TestCase {
	
	/*
	 * Returns an instance of this Test.
	 */
	public static Test suite() {
		return new TestSuite(SearchParticipantXMLTest.class);
	}

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

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

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

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

	public void testReturnedTitleNestedCase() {
		SearchHit[] hits = SearchTestUtils.getSearchHits("odoeofoedo", "en");
		assertEquals(hits.length,1);
		assertEquals("Participant XML 2 - tests nesting", hits[0].getLabel());
	}
	
	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