Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2011-04-04 21:43:52 +0000
committerRyan D. Brooks2011-04-04 21:43:52 +0000
commitd8883fdc192979211a028bf9350c0e2f390533dd (patch)
tree6f94fdec85c59271c378ab32de3f31c981748fc8 /plugins/org.eclipse.osee.framework.core.test
parentba27a34fc4df5e0e9c2cd943406da6d35f22770d (diff)
downloadorg.eclipse.osee-d8883fdc192979211a028bf9350c0e2f390533dd.tar.gz
org.eclipse.osee-d8883fdc192979211a028bf9350c0e2f390533dd.tar.xz
org.eclipse.osee-d8883fdc192979211a028bf9350c0e2f390533dd.zip
refinement: Prevent OseeCoreException null pointer exceptions
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.test')
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/exception/OseeCoreExceptionTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/exception/OseeCoreExceptionTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/exception/OseeCoreExceptionTest.java
index 30cedabb102..908921b1cdc 100644
--- a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/exception/OseeCoreExceptionTest.java
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/exception/OseeCoreExceptionTest.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.test.exception;
import junit.framework.Assert;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.junit.Test;
@@ -30,6 +31,31 @@ public class OseeCoreExceptionTest {
}
@Test
+ public void testNullMessageNullCause() {
+ Exception ex = new OseeCoreException((String) null, (Throwable) null);
+ Assert.assertEquals("Exception message unavaliable - message & exception were null", ex.getMessage());
+ }
+
+ @Test
+ public void testNullCause() {
+ Exception ex = new OseeCoreException("Error message", (Throwable) null);
+ Assert.assertEquals("Error message", ex.getMessage());
+ }
+
+ @Test
+ public void testNullMessageWithCause() {
+ Exception internalException = new Exception("My error message");
+ Exception ex = new OseeCoreException(null, internalException);
+ Assert.assertEquals(internalException.getMessage(), ex.getMessage());
+ }
+
+ @Test
+ public void testNullStatus() {
+ Exception ex = new OseeCoreException((IStatus) null);
+ Assert.assertEquals("Exception message unavaliable - status was null", ex.getMessage());
+ }
+
+ @Test
public void testMissingArguments() {
String messageFormat = "max = %d; min = %d; avg = %d";
Exception ex = new OseeCoreException(messageFormat, 1, 0);

Back to the top