diff options
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestValueStore.java')
-rw-r--r-- | core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestValueStore.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestValueStore.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestValueStore.java new file mode 100644 index 00000000000..739e890d603 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestValueStore.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2007 Symbian Software Limited 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: + * Bala Torati (Symbian) - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.templateengine; + +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateDescriptor; +import org.eclipse.cdt.core.testplugin.util.BaseTestCase; + + +/** + * Test the functionality of the ValueStore class. + */ +public class TestValueStore extends BaseTestCase { + + + /** + * setUp is called before execution of test method. + */ + protected void setUp() throws Exception { + super.setUp(); + } + + /** + * release resources held. + */ + protected void tearDown() throws Exception { + super.tearDown(); + } + + public TestValueStore(String name) { + super(name); + } + + /** + * Test ValueStore for Not Null condition. + * + */ + public void testValueStoreNotNull(){ + TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates(); + for (int i=0; i <templates.length; i++) { + Map valueStore = templates[i].getValueStore(); + assertNotNull(valueStore); + } + } + + /** + * ValueStore is expected to consist all the IDs from + * FactoryDefaults. Test the same. + */ + public void testCompareValueStoreWithTemplateDefaluts(){ + TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates(); + for (int i=0; i <templates.length; i++) { + Map valueStore = templates[i].getValueStore(); + TemplateDescriptor templateDescriptor = templates[i].getTemplateDescriptor(); + Map templateDefaults = templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()); + + Iterator defaultsIterator = templateDefaults.keySet().iterator(); + while(defaultsIterator.hasNext()){ + String key = (String)defaultsIterator.next(); + assertNotNull(valueStore.get(key)); + } + } + } + + +} |