Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2010-12-21 20:23:01 +0000
committerChris Goldthorpe2010-12-21 20:23:01 +0000
commit96a1efec3c5e08b37045c599547535a0d58185ed (patch)
tree225b7e44f90c473dec1638580f51504ea606797e /org.eclipse.ua.tests
parent625a55c1a1a5906f5229339b670aaf1a762240c0 (diff)
downloadeclipse.platform.ua-96a1efec3c5e08b37045c599547535a0d58185ed.tar.gz
eclipse.platform.ua-96a1efec3c5e08b37045c599547535a0d58185ed.tar.xz
eclipse.platform.ua-96a1efec3c5e08b37045c599547535a0d58185ed.zip
Create tests for ScopeSetManager
Diffstat (limited to 'org.eclipse.ua.tests')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/AllScopeTests.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java66
2 files changed, 67 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/AllScopeTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/AllScopeTests.java
index 63e9cac64..f5bbb5a9f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/AllScopeTests.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/AllScopeTests.java
@@ -32,5 +32,6 @@ public class AllScopeTests extends TestSuite {
addTestSuite(IntersectionTest.class);
addTestSuite(ScopeHierarchy.class);
addTestSuite(EmptyLeafRemoval.class);
+ addTestSuite(ScopeSetManagerTest.class);
}
}
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
new file mode 100644
index 000000000..6c235e136
--- /dev/null
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/ScopeSetManagerTest.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.scope;
+
+import junit.framework.TestCase;
+
+import org.eclipse.help.ui.internal.views.ScopeSet;
+import org.eclipse.help.ui.internal.views.ScopeSetManager;
+
+public class ScopeSetManagerTest extends TestCase {
+
+ public void testAddScope() {
+ String scopeName = "newScope1";
+ 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());
+ }
+
+ public void testAddAndRenameScope() {
+ String oldScopeName = "newScope2";
+ String newScopeName = "newScope3";
+ ScopeSetManager manager = new ScopeSetManager();
+ ScopeSet newScope = new ScopeSet(oldScopeName);
+ manager.add(newScope);
+ newScope.setName(newScopeName);
+ manager.save();
+ manager = new ScopeSetManager();
+ ScopeSet set = manager.findSet(newScopeName);
+ assertNotNull(set);
+ assertEquals(newScopeName, set.getName());
+ set = manager.findSet(oldScopeName);
+ assertNull(set);
+ }
+
+ 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