Author: dgolovin
Date: 2007-08-24 01:23:23 -0400 (Fri, 24 Aug 2007)
New Revision: 3311
Added:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/reporting/
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/reporting/test/
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/reporting/test/ProblemReportingHelperTest.java
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonPluginTest.java
Log:
http://jira.jboss.org/jira/browse/EXIN-13
Added:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/reporting/test/ProblemReportingHelperTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/reporting/test/ProblemReportingHelperTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/reporting/test/ProblemReportingHelperTest.java 2007-08-24
05:23:23 UTC (rev 3311)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.reporting.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.common.CommonPlugin;
+import org.jboss.tools.common.reporting.ProblemReportingHelper;
+
+/**
+ * @author eskimo
+ *
+ */
+public class ProblemReportingHelperTest extends TestCase {
+
+ boolean testPassed = false;
+
+
+
+ @Override
+ protected void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ testPassed = false;
+ CommonPlugin.getInstance().getLog().addLogListener(new ILogListener() {
+ public void logging(IStatus status, String plugin) {
+ testPassed = true;
+
+ }});
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.reporting.ProblemReportingHelper#reportProblem(java.lang.String,
java.lang.Throwable)}.
+ */
+ public void testReportProblemStringThrowable() {
+ ProblemReportingHelper.reportProblem(CommonPlugin.PLUGIN_ID, new
Throwable("Message"));
+ assertTrue(testPassed);
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.reporting.ProblemReportingHelper#reportProblem(java.lang.String,
java.lang.String, java.lang.Throwable)}.
+ */
+ public void testReportProblemStringStringThrowable() {
+ ProblemReportingHelper.reportProblem(CommonPlugin.PLUGIN_ID, "Message", new
Throwable("Message"));
+ assertTrue(testPassed);
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.reporting.ProblemReportingHelper#reportProblem(org.eclipse.core.runtime.IStatus)}.
+ */
+ public void testReportProblemIStatus() {
+ ProblemReportingHelper.reportProblem(Status.OK_STATUS);
+ assertTrue(testPassed);
+ }
+
+}
Added:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonPluginTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonPluginTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonPluginTest.java 2007-08-24
05:23:23 UTC (rev 3311)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.test;
+
+import org.jboss.tools.common.CommonPlugin;
+
+import junit.framework.TestCase;
+
+/**
+ * @author eskimo
+ *
+ */
+public class CommonPluginTest extends TestCase {
+
+ /**
+ * Test method for {@link org.jboss.tools.common.CommonPlugin#getInstance()}.
+ */
+ public void testGetInstance() {
+ assertNotNull("Common plugin is not loaded", CommonPlugin.getInstance());
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.CommonPlugin#getMessage(java.lang.String)}.
+ */
+ public void testGetMessage() {
+ assertNotNull(CommonPlugin.getMessage("reportingUrl"));
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.common.CommonPlugin#getEnvironment()}.
+ */
+ public void testGetEnvironment() {
+ assertNotNull(CommonPlugin.getEnvironment());
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.common.CommonPlugin#getDefault()}.
+ */
+ public void testGetDefault() {
+ assertNotNull(CommonPlugin.getDefault());
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.common.CommonPlugin#getPluginLog()}.
+ */
+ public void testGetPluginLog() {
+ assertNotNull(CommonPlugin.getPluginLog());
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logError(java.lang.String, java.lang.Throwable)}.
+ */
+ public void testLogErrorStringThrowable() {
+ CommonPlugin.getPluginLog().logError("Error message", new
Throwable("Message"));
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logError(java.lang.String)}.
+ */
+ public void testLogErrorString() {
+ CommonPlugin.getPluginLog().logError("Error message");
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logError(java.lang.Throwable)}.
+ */
+ public void testLogErrorThrowable() {
+ CommonPlugin.getPluginLog().logError(new Throwable("Message"));
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logWarning(java.lang.String, java.lang.Throwable)}.
+ */
+ public void testLogWarningStringThrowable() {
+ CommonPlugin.getPluginLog().logWarning("Message", new
Throwable("Message"));
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logWarning(java.lang.String)}.
+ */
+ public void testLogWarningString() {
+ CommonPlugin.getPluginLog().logWarning("Message");
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logWarning(java.lang.Throwable)}.
+ */
+ public void testLogWarningThrowable() {
+ CommonPlugin.getPluginLog().logWarning(new Throwable("Message"));
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logInfo(java.lang.String, java.lang.Throwable)}.
+ */
+ public void testLogInfoStringThrowable() {
+ CommonPlugin.getPluginLog().logInfo("Message", new
Throwable("Message"));
+ }
+
+ /**
+ * Test method for {@link
org.jboss.tools.common.log.BasePlugin#logInfo(java.lang.String)}.
+ */
+ public void testLogInfoString() {
+ CommonPlugin.getPluginLog().logInfo("message");
+ }
+
+}