Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-01-18 18:06:51 +0000
committerAlexander Kurtakov2016-01-18 18:06:51 +0000
commit926b52a7799d5ee3a4a46416d5178c14a9c528ec (patch)
tree87b35e15a0d531b9f08328d23b0d749f3052d687 /org.eclipse.ua.tests/help
parent68f19e45b8263268d7fd1e439d1eb7ad6ac3d4ac (diff)
downloadeclipse.platform.ua-926b52a7799d5ee3a4a46416d5178c14a9c528ec.tar.gz
eclipse.platform.ua-926b52a7799d5ee3a4a46416d5178c14a9c528ec.tar.xz
eclipse.platform.ua-926b52a7799d5ee3a4a46416d5178c14a9c528ec.zip
Bug 485918 - Convert org.eclipse.ua.tests to JUnit 4
Migrate AddDynamicTests and AllScopeTests. Change-Id: I13def7673fbda0e0054b3a0802509d5b9347fa21 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.ua.tests/help')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java37
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java34
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/EmptyLeafRemoval.java30
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java28
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeHierarchy.java66
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java21
6 files changed, 141 insertions, 75 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
index 6d94b18ce..20a318b7b 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 IBM Corporation and others.
+ * 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.ua.tests.help.dynamic;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -22,19 +24,19 @@ import org.eclipse.help.internal.xhtml.DynamicXHTMLProcessor;
import org.eclipse.help.ui.internal.HelpUIPlugin;
import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
import org.eclipse.ua.tests.util.XMLUtil;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.Bundle;
import org.xml.sax.SAXException;
-import junit.framework.TestCase;
-
-public class DynamicXHTMLProcessorTest extends TestCase {
+public class DynamicXHTMLProcessorTest {
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
// activate the UI plug-in for UI filtering ability
HelpUIPlugin.getDefault();
}
-
+
private String process(String path) throws Exception {
Bundle bundle = UserAssistanceTestPlugin.getDefault().getBundle();
InputStream is = getProcessedInput(path, bundle);
@@ -48,7 +50,7 @@ public class DynamicXHTMLProcessorTest extends TestCase {
String href = '/' + bundle.getBundleId() +path;
return DynamicXHTMLProcessor.process(href, in, "en", true);
}
-
+
private String readStream(InputStream is) throws Exception {
InputStreamReader inputStreamReader = new InputStreamReader(is, "UTF-8");
StringBuffer buffer = new StringBuffer();
@@ -64,39 +66,46 @@ public class DynamicXHTMLProcessorTest extends TestCase {
return buffer.toString();
}
+ @Test
public void testXhtmlNoCollapseAnchor() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyAnchor.xhtml");
assertTrue("Anchor collapsed in " + processed, processed.indexOf("</a>") > 0);
}
-
+
+ @Test
public void testXhtmlNoCollapseParagraph() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyAnchor.xhtml");
assertTrue("Paragraph collapsed in " + processed, processed.indexOf("</p>") > 0);
}
-
+
+ @Test
public void testXhtmlNoCollapseAnchorIC() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyAnchorWithComment.xhtml");
assertTrue("Anchor collapsed in " + processed, processed.indexOf("</a>") > 0);
}
-
+
+ @Test
public void testXhtmlNoCollapseParagraphIC() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyAnchorWithComment.xhtml");
assertTrue("Paragraph collapsed in " + processed, processed.indexOf("</p>") > 0);
}
+ @Test
public void testXhtmlNoCollapseDiv() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyDiv.xhtml");
assertTrue("Div collapsed in " + processed, processed.indexOf("</div>") > 0);
}
-
+
+ @Test
public void testXhtmlNoCollapseScript() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyAnchor.xhtml");
assertTrue("Div collapsed in " + processed, processed.indexOf("</script>") > 0);
}
-
+
+ @Test
public void testValidXML() throws Exception {
String processed = process("data/help/dynamic/xhtml/emptyAnchor.xhtml");
XMLUtil.assertParseableXML(processed);
}
-
+
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
index 7706acd70..8535f43bb 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -24,14 +24,14 @@ import org.eclipse.help.ui.internal.HelpUIPlugin;
import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
import org.eclipse.ua.tests.util.FileUtil;
import org.eclipse.ua.tests.util.XMLUtil;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.Bundle;
-import junit.framework.TestCase;
+public class XMLProcessorTest {
-public class XMLProcessorTest extends TestCase {
-
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
// activate the UI plug-in for UI filtering ability
HelpUIPlugin.getDefault();
}
@@ -50,34 +50,42 @@ public class XMLProcessorTest extends TestCase {
XMLUtil.assertXMLEquals("XML content was not processed correctly: " + path, in, in2);
}
+ @Test
public void testExtension() throws Exception {
xmlProcess("data/help/dynamic/extension.xml");
}
-
+
+ @Test
public void testFilter() throws Exception {
xmlProcess("data/help/dynamic/filter.xml");
}
-
+
+ @Test
public void testInclude() throws Exception {
xmlProcess("data/help/dynamic/include.xml");
}
-
+
+ @Test
public void testIndex() throws Exception {
xmlProcess("data/help/dynamic/index.xml");
}
-
+
+ @Test
public void testSimple() throws Exception {
xmlProcess("data/help/dynamic/simple.xml");
}
-
+
+ @Test
public void testToc() throws Exception {
xmlProcess("data/help/dynamic/toc.xml");
}
-
+
+ @Test
public void testXhtml() throws Exception {
xmlProcess("data/help/dynamic/xhtml.xml");
}
-
+
+ @Test
public void testEntities() throws Exception {
xmlProcess("data/help/dynamic/entities.xml");
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/EmptyLeafRemoval.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/EmptyLeafRemoval.java
index f7acfc428..da4bf23a2 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/EmptyLeafRemoval.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/EmptyLeafRemoval.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * 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
@@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.ua.tests.help.scope;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Test that leaf topics with no href do not show in the tree
@@ -22,14 +23,16 @@ import org.eclipse.help.internal.base.scope.ScopeUtils;
import org.eclipse.ua.tests.help.other.UserIndexEntry;
import org.eclipse.ua.tests.help.other.UserToc;
import org.eclipse.ua.tests.help.other.UserTopic;
+import org.junit.Test;
-public class EmptyLeafRemoval extends TestCase {
-
+public class EmptyLeafRemoval {
+ @Test
public void testEmptyLeafTopic() {
UserTopic topic = new UserTopic("ab", null, true);
assertFalse(ScopeUtils.showInTree(topic, new MockScope('a', false)));
}
+ @Test
public void testEmptyParentOfEmptyLeafTopic() {
UserTopic topic = new UserTopic("ab", null, true);
UserTopic child = new UserTopic("ac", null, true);
@@ -37,6 +40,7 @@ public class EmptyLeafRemoval extends TestCase {
assertFalse(ScopeUtils.showInTree(topic, new MockScope('a', false)));
}
+ @Test
public void testEmptyParentOfNonEmptyLeafTopic() {
UserTopic topic = new UserTopic("ab", null, true);
UserTopic child = new UserTopic("ac", "http://www.eclipse.org", true);
@@ -44,13 +48,15 @@ public class EmptyLeafRemoval extends TestCase {
assertTrue(ScopeUtils.showInTree(topic, new MockScope('a', false)));
}
+ @Test
public void testEmptyParentOfNonEmptyLeafTopicHierarchical() {
UserTopic topic = new UserTopic("ab", null, true);
UserTopic child = new UserTopic("ac", "http://www.eclipse.org", true);
topic.addTopic(child);
assertTrue(ScopeUtils.showInTree(topic, new MockScope('a', true)));
}
-
+
+ @Test
public void testEmptyGrandParentWithOutOfScopeChildTopicHierarchical() {
UserTopic topic = new UserTopic("ab", null, true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -59,7 +65,8 @@ public class EmptyLeafRemoval extends TestCase {
child.addTopic(grandChild);
assertFalse(ScopeUtils.showInTree(topic, new MockScope('a', true)));
}
-
+
+ @Test
public void testEmptyGrandparentOfNonEmptyLeafTopicHierarchical() {
UserTopic topic = new UserTopic("ab", null, true);
UserTopic child = new UserTopic("ac", null, true);
@@ -69,6 +76,7 @@ public class EmptyLeafRemoval extends TestCase {
assertTrue(ScopeUtils.showInTree(topic, new MockScope('a', true)));
}
+ @Test
public void testTocParentOfEmptyLeaf() {
UserToc toc = new UserToc("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("ac", null, true);
@@ -76,7 +84,8 @@ public class EmptyLeafRemoval extends TestCase {
AbstractHelpScope scope = new MockScope('a', false);
assertFalse(ScopeUtils.showInTree(toc, scope));
}
-
+
+ @Test
public void testTocParentOfNonEmptyLeaf() {
UserToc toc = new UserToc("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("ac", "http://www.eclipse.org", true);
@@ -85,6 +94,7 @@ public class EmptyLeafRemoval extends TestCase {
assertTrue(ScopeUtils.showInTree(toc, scope));
}
+ @Test
public void testEntryParentOfEmptyLeaf() {
UserIndexEntry entry = new UserIndexEntry("ab", true);
UserTopic child = new UserTopic("ac", null, true);
@@ -93,6 +103,7 @@ public class EmptyLeafRemoval extends TestCase {
assertFalse(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testEntryParentOfNonEmptyLeaf() {
UserIndexEntry entry = new UserIndexEntry("ab", true);
UserTopic child = new UserTopic("ac", "http://www.eclipse.org", true);
@@ -100,7 +111,8 @@ public class EmptyLeafRemoval extends TestCase {
AbstractHelpScope scope = new MockScope('a', true);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
-
+
+ @Test
public void testEntryGrandParentOfNonEmptyLeaf() {
UserIndexEntry entry = new UserIndexEntry("ab", true);
UserIndexEntry child = new UserIndexEntry("ab", true);
@@ -110,5 +122,5 @@ public class EmptyLeafRemoval extends TestCase {
AbstractHelpScope scope = new MockScope('a', true);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
-
+
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java
index df6970891..b2dc2fe3a 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * 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
@@ -10,14 +10,16 @@
*******************************************************************************/
package org.eclipse.ua.tests.help.scope;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import org.eclipse.help.base.AbstractHelpScope;
import org.eclipse.help.internal.base.scope.IntersectionScope;
import org.eclipse.ua.tests.help.other.UserTopic;
+import org.junit.Test;
+
+public class IntersectionTest {
-public class IntersectionTest extends TestCase {
-
private AbstractHelpScope createScope(char char1, char char2) {
AbstractHelpScope result = new IntersectionScope(
new AbstractHelpScope[]{new MockScope(char1, true),
@@ -25,28 +27,32 @@ public class IntersectionTest extends TestCase {
return result;
}
+ @Test
public void testInIn() {
UserTopic topic = new UserTopic("ab", "http://www.eclipse.org", true);
AbstractHelpScope scope = createScope('a', 'b');
- assertTrue(scope.inScope(topic));
+ assertTrue(scope.inScope(topic));
}
+ @Test
public void testInOut() {
UserTopic topic = new UserTopic("a", "http://www.eclipse.org", true);
AbstractHelpScope scope = createScope('a', 'b');
- assertFalse(scope.inScope(topic));
+ assertFalse(scope.inScope(topic));
}
-
+
+ @Test
public void testOutIn() {
UserTopic topic = new UserTopic("b", "http://www.eclipse.org", true);
AbstractHelpScope scope = createScope('a', 'b');
- assertFalse(scope.inScope(topic));
+ assertFalse(scope.inScope(topic));
}
-
+
+ @Test
public void testOutOut() {
UserTopic topic = new UserTopic("c", "http://www.eclipse.org", true);
AbstractHelpScope scope = createScope('a', 'b');
- assertFalse(scope.inScope(topic));
+ assertFalse(scope.inScope(topic));
}
-
+
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeHierarchy.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeHierarchy.java
index dfa9b7883..9dd8d7bef 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeHierarchy.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeHierarchy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * 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
@@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.ua.tests.help.scope;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import org.eclipse.help.IIndexEntry2;
import org.eclipse.help.IIndexSee;
@@ -22,9 +23,10 @@ import org.eclipse.ua.tests.help.other.UserIndexEntry;
import org.eclipse.ua.tests.help.other.UserIndexSee;
import org.eclipse.ua.tests.help.other.UserToc;
import org.eclipse.ua.tests.help.other.UserTopic;
+import org.junit.Test;
-public class ScopeHierarchy extends TestCase {
-
+public class ScopeHierarchy {
+ @Test
public void testHierarchicalToc() {
UserToc toc = new UserToc("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -33,6 +35,7 @@ public class ScopeHierarchy extends TestCase {
assertFalse(ScopeUtils.showInTree(toc, scope));
}
+ @Test
public void testHierarchicalTocDepth3() {
UserToc toc = new UserToc("c", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("b", "http://www.eclipse.org", true);
@@ -42,7 +45,8 @@ public class ScopeHierarchy extends TestCase {
AbstractHelpScope scope = new MockScope('c', true);
assertFalse(ScopeUtils.showInTree(toc, scope));
}
-
+
+ @Test
public void testNonHierarchicalTocDepth3() {
UserToc toc = new UserToc("a", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("b", "http://www.eclipse.org", true);
@@ -53,6 +57,7 @@ public class ScopeHierarchy extends TestCase {
assertTrue(ScopeUtils.showInTree(toc, scope));
}
+ @Test
public void testNonHierarchicalToc() {
UserToc toc = new UserToc("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -60,7 +65,8 @@ public class ScopeHierarchy extends TestCase {
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(toc, scope));
}
-
+
+ @Test
public void testHierarchicalTopic() {
UserTopic topic = new UserTopic("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -69,6 +75,7 @@ public class ScopeHierarchy extends TestCase {
assertFalse(ScopeUtils.showInTree(topic, scope));
}
+ @Test
public void testNonHierarchicalTopic() {
UserTopic topic = new UserTopic("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -76,7 +83,8 @@ public class ScopeHierarchy extends TestCase {
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(topic, scope));
}
-
+
+ @Test
public void testNonHierarchicalTopicThreeDeep() {
UserTopic topic = new UserTopic("ab", "http://www.eclipse.org", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -87,6 +95,7 @@ public class ScopeHierarchy extends TestCase {
assertTrue(ScopeUtils.showInTree(topic, scope));
}
+ @Test
public void testHierarchicalEntry() {
UserIndexEntry entry = new UserIndexEntry("ab", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -95,6 +104,7 @@ public class ScopeHierarchy extends TestCase {
assertFalse(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testNonHierarchicalEntry() {
UserIndexEntry entry = new UserIndexEntry("ab", true);
UserTopic child = new UserTopic("c", "http://www.eclipse.org", true);
@@ -102,7 +112,8 @@ public class ScopeHierarchy extends TestCase {
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
-
+
+ @Test
public void testNonHierarchicalEntryThreeDeep() {
UserIndexEntry entry = new UserIndexEntry("a", true);
UserIndexEntry childEntry = new UserIndexEntry("b", true);
@@ -112,7 +123,8 @@ public class ScopeHierarchy extends TestCase {
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
-
+
+ @Test
public void testHierarchicalEntryThreeDeep() {
UserIndexEntry entry = new UserIndexEntry("a", true);
UserIndexEntry childEntry = new UserIndexEntry("c", true);
@@ -122,7 +134,8 @@ public class ScopeHierarchy extends TestCase {
AbstractHelpScope scope = new MockScope('c', true);
assertFalse(ScopeUtils.showInTree(entry, scope));
}
-
+
+ @Test
public void testHierarchicalEntryNoInScopeSubtopic() {
UserIndexEntry entry = new UserIndexEntry("c", true);
UserTopic child = new UserTopic("a", "http://www.eclipse.org", true);
@@ -131,6 +144,7 @@ public class ScopeHierarchy extends TestCase {
assertFalse(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testNonHierarchicalEntryNoInScopeSubtopic() {
UserIndexEntry entry = new UserIndexEntry("c", true);
UserTopic child = new UserTopic("a", "http://www.eclipse.org", true);
@@ -139,78 +153,90 @@ public class ScopeHierarchy extends TestCase {
assertFalse(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testSeeTargetInScopeNonHierarchical() {
IIndexSee see = createSee("compile", "c++");
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(see, scope));
}
-
+
+ @Test
public void testSeeParentTargetInScopeNonHierarchical() {
IIndexEntry2 entry = createSeeParentEntry("compile", "c++");
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testSeeTargetOutOfScopeNonHierarchical() {
IIndexSee see = createSee("build", "c++");
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(see, scope));
}
-
+
+ @Test
public void testSeeParentTargetOutOfScopeNonHierarchical() {
IIndexEntry2 entry = createSeeParentEntry("build", "c++");
AbstractHelpScope scope = new MockScope('c', false);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testSeeTargetWithChildOutOfScopeNonHierarchical() {
IIndexSee see = createSee("compilation", "build");
AbstractHelpScope scope = new MockScope('c', false);
assertFalse(ScopeUtils.showInTree(see, scope));
}
-
+
+ @Test
public void testSeeParentTargetWithChildOutOfScopeNonHierarchical() {
IIndexEntry2 entry = createSeeParentEntry("compilation", "build");
AbstractHelpScope scope = new MockScope('c', false);
assertFalse(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testSeeTargetInScopeHierarchical() {
IIndexSee see = createSee("compile", "c++");
AbstractHelpScope scope = new MockScope('c', true);
assertTrue(ScopeUtils.showInTree(see, scope));
}
-
+
+ @Test
public void testSeeParentTargetInScopeHierarchical() {
IIndexEntry2 entry = createSeeParentEntry("compile", "c++");
AbstractHelpScope scope = new MockScope('c', true);
assertTrue(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testSeeTargetOutOfScopeHierarchical() {
IIndexSee see = createSee("build", "c++");
AbstractHelpScope scope = new MockScope('c', true);
assertFalse(ScopeUtils.showInTree(see, scope));
}
-
+
+ @Test
public void testSeeParentTargetOutOfScopeHierarchical() {
IIndexEntry2 entry = createSeeParentEntry("build", "c++");
AbstractHelpScope scope = new MockScope('c', true);
assertFalse(ScopeUtils.showInTree(entry, scope));
}
+ @Test
public void testSeeTargetWithChildOutOfScopeHierarchical() {
IIndexSee see = createSee("compilation", "build");
AbstractHelpScope scope = new MockScope('c', true);
assertFalse(ScopeUtils.showInTree(see, scope));
}
-
+
+ @Test
public void testSeeParentTargetWithChildOutOfScopeHierarchical() {
IIndexEntry2 entry = createSeeParentEntry("compilation", "build");
AbstractHelpScope scope = new MockScope('c', true);
assertFalse(ScopeUtils.showInTree(entry, scope));
}
-
+
private IIndexSee createSee(String targetEntryName, String targetTopicName) {
IIndexEntry2 entry = createSeeParentEntry(targetEntryName, targetTopicName);
return entry.getSees()[0];
@@ -226,10 +252,10 @@ public class ScopeHierarchy extends TestCase {
UserTopic child = new UserTopic(targetTopicName, "http://www.eclipse.org", true);
targetEntry.addTopic(child);
UserIndexSee userSee = new UserIndexSee(targetEntryName, false);
- seeParentEntry.addSee(userSee);
+ seeParentEntry.addSee(userSee);
Index index = new Index(userIndex);
entry = (IIndexEntry2)index.getEntries()[1];
return entry;
- }
-
+ }
+
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java
index 6c235e136..e6facb22f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * 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
@@ -10,13 +10,16 @@
*******************************************************************************/
package org.eclipse.ua.tests.help.scope;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.eclipse.help.ui.internal.views.ScopeSet;
import org.eclipse.help.ui.internal.views.ScopeSetManager;
+import org.junit.Test;
-public class ScopeSetManagerTest extends TestCase {
-
+public class ScopeSetManagerTest {
+ @Test
public void testAddScope() {
String scopeName = "newScope1";
ScopeSetManager manager = new ScopeSetManager();
@@ -28,7 +31,8 @@ public class ScopeSetManagerTest extends TestCase {
assertNotNull(set);
assertEquals(scopeName, set.getName());
}
-
+
+ @Test
public void testAddAndRenameScope() {
String oldScopeName = "newScope2";
String newScopeName = "newScope3";
@@ -44,20 +48,21 @@ public class ScopeSetManagerTest extends TestCase {
set = manager.findSet(oldScopeName);
assertNull(set);
}
-
+
+ @Test
public void testAddAndDeleteScope() {
String scopeName = "newScope4";
ScopeSetManager manager = new ScopeSetManager();
ScopeSet newScope = new ScopeSet(scopeName);
manager.add(newScope);
manager.save();
-
+
manager = new ScopeSetManager();
ScopeSet set = manager.findSet(scopeName);
assertNotNull(set);
assertEquals(scopeName, set.getName());
manager.remove(set);
-
+
manager = new ScopeSetManager();
set = manager.findSet(scopeName);
assertNull(set);

Back to the top