diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/ScopeTest.java')
-rw-r--r-- | plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/ScopeTest.java | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/ScopeTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/ScopeTest.java new file mode 100644 index 00000000000..83e36b01030 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/ScopeTest.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * 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: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.core.model.access; + +import junit.framework.Assert; +import org.junit.Test; + +/** + * @author John Misinco + */ +public class ScopeTest { + + @Test + public void testGetPath() { + Scope scope = new Scope(); + scope.add("foo"); + scope.add("bar bar"); + scope.addSubPath("baz"); + String expectedPath = "/foo/bar_bar#baz"; + Assert.assertEquals(expectedPath, scope.getPath()); + } + + @Test + public void testEquals() { + Scope legacyScopeA = Scope.createLegacyScope(); + Scope legacyScopeB = Scope.createLegacyScope(); + legacyScopeA.add("foo"); + legacyScopeB.addSubPath("bar"); + Assert.assertTrue(legacyScopeA.equals(legacyScopeB)); + + Scope scopeA = new Scope(); + Scope scopeB = new Scope(); + scopeA.add("foo"); + scopeA.addSubPath("bar"); + scopeA.add("baz"); + scopeB.add("foo"); + scopeB.addSubPath("bar"); + scopeB.add("baz"); + Assert.assertTrue(scopeA.equals(scopeB)); + + Scope scopeC = new Scope(); + Assert.assertFalse(legacyScopeA.equals(scopeA)); + Assert.assertFalse(legacyScopeA.equals(scopeC)); + } + + @Test + public void testIsLegacy() { + Scope legacyScope = Scope.createLegacyScope(); + Scope scope = new Scope(); + legacyScope.add("foo"); + legacyScope.addSubPath("bar"); + String expectedScope = "##"; + Assert.assertEquals(expectedScope, legacyScope.getPath()); + Assert.assertTrue(legacyScope.isLegacy()); + Assert.assertFalse(scope.isLegacy()); + } + + @Test + public void testClone() { + Scope scope = new Scope(); + Scope legacyScope = Scope.createLegacyScope(); + + scope.add("foo").add("bar").addSubPath("baz").addSubPath("baz"); + Scope scopeClone = scope.clone(); + Assert.assertEquals(scope, scopeClone); + + scopeClone = legacyScope.clone(); + Assert.assertTrue(legacyScope.equals(scopeClone)); + } + +} |