Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Propose patch for JUnit tests.

Not applied, do not have the permission.

2002-10-30 Alain Magloire

	* model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID):
	The fields and the methods use in this test was removed from the CoreModel class.
	(testHasNature): The method use in this case was refactor in the classes
	CProjectNature and CCProjectNature, fix the test.



Index: model/org/eclipse/cdt/core/model/tests/CModelTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/CModelTests.java,v
retrieving revision 1.2
diff -u -r1.2 CModelTests.java
--- model/org/eclipse/cdt/core/model/tests/CModelTests.java	27 Sep 2002 13:46:54 -0000	1.2
+++ model/org/eclipse/cdt/core/model/tests/CModelTests.java	30 Oct 2002 19:55:15 -0000
@@ -12,6 +12,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import org.eclipse.cdt.testplugin.*;
+import org.eclipse.cdt.core.CCProjectNature;
 import org.eclipse.cdt.core.model.*;
 import org.eclipse.core.resources.*;
 import org.eclipse.core.runtime.*;
@@ -90,21 +91,21 @@
      * are returning sane values
      */
    public void testGetNatureId(){
-        assertTrue("GetCNatureId returns correct value", CoreModel.getDefault().getCNatureId().equals(CoreModel.C_NATURE_ID));
-        assertTrue("GetCNatureName returns correct value", CoreModel.getDefault().getCNatureName().equals(CoreModel.C_NATURE_NAME));
-
-        assertTrue("GetCCNatureId returns correct value", CoreModel.getDefault().getCCNatureId().equals(CoreModel.CC_NATURE_ID));
-        assertTrue("GetCCNatureName returns correct value", CoreModel.getDefault().getCCNatureName().equals(CoreModel.CC_NATURE_NAME));
-
-        /***
-         * The following tests are here to make sure the names/ids of the 
-         * natures do not change over time. Changing them would likely break
-         * backwards compatibility, so if it happens, we should know about it.
-         */
-        assertTrue("C_NATURE_NAME is constant", CoreModel.C_NATURE_NAME.equals("cnature"));
-        assertTrue("C_NATURE_ID is constant", CoreModel.C_NATURE_ID.equals("org.eclipse.cdt.core.cnature"));
-        assertTrue("CC_NATURE_NAME is constant", CoreModel.CC_NATURE_NAME.equals("ccnature"));
-        assertTrue("CC_NATURE_ID is constant", CoreModel.CC_NATURE_ID.equals("org.eclipse.cdt.core.ccnature"));
+//        assertTrue("GetCNatureId returns correct value", CoreModel.getDefault().getCNatureId().equals(CoreModel.C_NATURE_ID));
+//        assertTrue("GetCNatureName returns correct value", CoreModel.getDefault().getCNatureName().equals(CoreModel.C_NATURE_NAME));
+//
+//        assertTrue("GetCCNatureId returns correct value", CoreModel.getDefault().getCCNatureId().equals(CoreModel.CC_NATURE_ID));
+//        assertTrue("GetCCNatureName returns correct value", CoreModel.getDefault().getCCNatureName().equals(CoreModel.CC_NATURE_NAME));
+//
+//        /***
+//         * The following tests are here to make sure the names/ids of the 
+//         * natures do not change over time. Changing them would likely break
+//         * backwards compatibility, so if it happens, we should know about it.
+//         */
+//        assertTrue("C_NATURE_NAME is constant", CoreModel.C_NATURE_NAME.equals("cnature"));
+//        assertTrue("C_NATURE_ID is constant", CoreModel.C_NATURE_ID.equals("org.eclipse.cdt.core.cnature"));
+//        assertTrue("CC_NATURE_NAME is constant", CoreModel.CC_NATURE_NAME.equals("ccnature"));
+//        assertTrue("CC_NATURE_ID is constant", CoreModel.CC_NATURE_ID.equals("org.eclipse.cdt.core.ccnature"));
 
 
     }
@@ -127,11 +128,11 @@
             fail("Unable to create project");
         assertTrue("hasCNature works", CoreModel.hasCNature(testProject.getProject()));
         assertTrue("hasCCNature works without ccnature", !(CoreModel.hasCCNature(testProject.getProject())));
-        CoreModel.addCCNature(testProject.getProject(), monitor);
+        CCProjectNature.addCCNature(testProject.getProject(), monitor);
         assertTrue("hasCCNature works", (CoreModel.hasCCNature(testProject.getProject())));
         
-        CoreModel.removeCCNature(testProject.getProject(), monitor);
-        CoreModel.removeCNature(testProject.getProject(), monitor);                
+        CCProjectNature.removeCCNature(testProject.getProject(), monitor);
+        CCProjectNature.removeCNature(testProject.getProject(), monitor);                
         assertTrue("hasCNature works without cnature", !CoreModel.hasCNature(testProject.getProject()));
         assertTrue("hasCCNature works without ccnature or cnature", !(CoreModel.hasCCNature(testProject.getProject())));
 



Back to the top