Author: dgolovin
Date: 2009-02-10 19:15:46 -0500 (Tue, 10 Feb 2009)
New Revision: 13576
Added:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/test/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/test/AntParserTest.java
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/test/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/test/DeveloperExceptionTest.java
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/test/
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/test/FavoritesClassControllerTest.java
Modified:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/CommonModelAllTests.java
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
Log:
increase code coverage for JUnit tests
Added:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/test/AntParserTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/test/AntParserTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/test/AntParserTest.java 2009-02-11
00:15:46 UTC (rev 13576)
@@ -0,0 +1,16 @@
+package org.jboss.tools.common.ant.parser.test;
+
+import org.jboss.tools.common.ant.parser.AntParser;
+
+import junit.framework.TestCase;
+
+public class AntParserTest extends TestCase {
+
+ public static final String ANT_FILE_CONTENT="<project><target
name=\"name1\"/><target name=\"name2\"/><target
name=\"name3\"/ </project>";
+
+ public void testGetTargets() {
+ AntParser parser = new AntParser(ANT_FILE_CONTENT);
+ assertEquals(3,parser.getTargets());
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/ant/parser/test/AntParserTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/test/DeveloperExceptionTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/test/DeveloperExceptionTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/test/DeveloperExceptionTest.java 2009-02-11
00:15:46 UTC (rev 13576)
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package org.jboss.tools.common.model.exception.test;
+
+import org.jboss.tools.common.model.exception.DeveloperException;
+
+import junit.framework.TestCase;
+
+/**
+ * @author eskimo
+ *
+ */
+public class DeveloperExceptionTest extends TestCase {
+
+ private final Throwable THROWABLE = new Throwable();
+ private final String MESSAGE = "Message";
+
+ /**
+ * @param name
+ */
+ public DeveloperExceptionTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.model.exception.DeveloperException#DeveloperException(java.lang.String)}.
+ */
+ public void testDeveloperExceptionString() {
+ DeveloperException ex = new DeveloperException(MESSAGE);
+ assertEquals(MESSAGE, ex.getMessage());
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.model.exception.DeveloperException#DeveloperException(java.lang.String,
java.lang.Throwable)}.
+ */
+ public void testDeveloperExceptionStringThrowable() {
+
+ DeveloperException ex = new DeveloperException(MESSAGE, THROWABLE);
+ assertEquals(MESSAGE, ex.getMessage());
+ assertEquals(THROWABLE, ex.getCause());
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.model.exception.DeveloperException#DeveloperException(java.lang.Throwable)}.
+ */
+ public void testDeveloperExceptionThrowable() {
+ DeveloperException ex = new DeveloperException(THROWABLE);
+ assertEquals(THROWABLE, ex.getCause());
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/exception/test/DeveloperExceptionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/CommonModelAllTests.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/CommonModelAllTests.java 2009-02-10
23:22:56 UTC (rev 13575)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/CommonModelAllTests.java 2009-02-11
00:15:46 UTC (rev 13576)
@@ -10,6 +10,9 @@
******************************************************************************/
package org.jboss.tools.common.model.test;
+import org.jboss.tools.common.ant.parser.test.AntParserTest;
+import org.jboss.tools.common.model.exception.test.DeveloperExceptionTest;
+
import junit.framework.Test;
import junit.framework.TestSuite;
/**
@@ -24,6 +27,8 @@
suite.setName("All tests for " + PLUGIN_ID);
suite.addTestSuite(MetaModelTest.class);
suite.addTestSuite(ClassPathTest.class);
+ suite.addTestSuite(AntParserTest.class);
+ suite.addTestSuite(DeveloperExceptionTest.class);
return suite;
}
}
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/test/FavoritesClassControllerTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/test/FavoritesClassControllerTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/test/FavoritesClassControllerTest.java 2009-02-11
00:15:46 UTC (rev 13576)
@@ -0,0 +1,58 @@
+/**
+ *
+ */
+package org.jboss.tools.common.core.jdt.test;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.core.jdt.FavoritesClassController;
+
+/**
+ * @author eskimo
+ *
+ */
+public class FavoritesClassControllerTest extends TestCase {
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.core.jdt.FavoritesClassController#getFavoritesClassesList()}.
+ */
+ public void testGetFavoritesClassesList() {
+ List<String> favClasses = FavoritesClassController.getFavoritesClassesList();
+ assertEquals(0, favClasses.size());
+ FavoritesClassController.push("corg.jboss.TestClass1");
+ FavoritesClassController.push("corg.jboss.TestClass2");
+ FavoritesClassController.push("corg.jboss.TestClass3");
+ FavoritesClassController.push("corg.jboss.TestClass4");
+ FavoritesClassController.push("corg.jboss.TestClass5");
+ favClasses = FavoritesClassController.getFavoritesClassesList();
+ assertEquals(5, favClasses.size());
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.core.jdt.FavoritesClassController#push(java.lang.String)}.
+ */
+ public void testPush() {
+ FavoritesClassController.push("corg.jboss.TestClass1");
+ List<String> favClasses = FavoritesClassController.getFavoritesClassesList();
+ assertEquals("corg.jboss.TestClass1", favClasses.get(0));
+ FavoritesClassController.push("corg.jboss.TestClass5");
+ favClasses = FavoritesClassController.getFavoritesClassesList();
+ assertEquals("corg.jboss.TestClass5", favClasses.get(0));
+ FavoritesClassController.push("corg.jboss.TestClass6");
+ favClasses = FavoritesClassController.getFavoritesClassesList();
+ assertEquals("corg.jboss.TestClass6", favClasses.get(0));
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.core.jdt.FavoritesClassController#getLabelProvider()}.
+ */
+ public void testGetLabelProvider() {
+ Image img1 = FavoritesClassController.getLabelProvider().getImage(new Object());
+ Image img2 = FavoritesClassController.getLabelProvider().getImage(new Object());
+ assertTrue(img1==img2);
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/core/jdt/test/FavoritesClassControllerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2009-02-10
23:22:56 UTC (rev 13575)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2009-02-11
00:15:46 UTC (rev 13576)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.test;
+import org.jboss.tools.common.core.jdt.test.FavoritesClassControllerTest;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -25,6 +27,7 @@
suite.setName("All tests for " + PLUGIN_ID);
suite.addTestSuite(ModelUiPreferencesPageTest.class);
suite.addTestSuite(ObjectDecoratorTest.class);
+ suite.addTestSuite(FavoritesClassControllerTest.class);
return suite;
}
Show replies by date