Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2009-01-21 01:16:20 +0000
committerslewis2009-01-21 01:16:20 +0000
commit559693b09657182663c63a98636c4cfe465368cd (patch)
treef157e1a9c59283c4bc46cafd3a7af4d8c8644a9b /tests/bundles/org.eclipse.ecf.tests
parent220819dee1f9cc0d2b75c5f2aa8584e2ffe7286a (diff)
downloadorg.eclipse.ecf-559693b09657182663c63a98636c4cfe465368cd.tar.gz
org.eclipse.ecf-559693b09657182663c63a98636c4cfe465368cd.tar.xz
org.eclipse.ecf-559693b09657182663c63a98636c4cfe465368cd.zip
Added tests for SerializableStatus
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests')
-rw-r--r--tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/core/util/SerializableStatusTest.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/core/util/SerializableStatusTest.java b/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/core/util/SerializableStatusTest.java
new file mode 100644
index 000000000..46df5a5dd
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/core/util/SerializableStatusTest.java
@@ -0,0 +1,62 @@
+package org.eclipse.ecf.tests.core.util;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.core.util.SerializableStatus;
+import org.eclipse.ecf.internal.tests.Activator;
+
+import junit.framework.TestCase;
+
+public class SerializableStatusTest extends TestCase {
+
+
+ protected IStatus createOKStatus() {
+ return SerializableStatus.OK_STATUS;
+ }
+
+ protected IStatus createErrorStatus() {
+ return new SerializableStatus(IStatus.ERROR,Activator.PLUGIN_ID,IStatus.ERROR,"error",new IllegalArgumentException("myexception"));
+ }
+
+ public static class MyNotSerializableException extends Exception {
+
+ Object notSerializableObject = new Object();
+
+ public MyNotSerializableException(String message) {
+ super(message);
+ }
+ }
+
+ protected IStatus createNotSerializableExceptionStatus() {
+ return new SerializableStatus(IStatus.ERROR,Activator.PLUGIN_ID,IStatus.ERROR,"error",new MyNotSerializableException("myexception"));
+ }
+
+ public void testCreateStatus() throws Exception {
+ IStatus s = createOKStatus();
+ assertNotNull(s);
+ assertTrue(s.isOK());
+ assertTrue(s.getCode() == SerializableStatus.OK);
+ assertTrue(s.getMessage().equals("ok"));
+ assertTrue(s.getException() == null);
+ }
+
+ public void testCreateExceptionStatus() throws Exception {
+ IStatus s = createErrorStatus();
+ assertNotNull(s);
+ assertFalse(s.isOK());
+ assertTrue(s.getCode() == IStatus.ERROR);
+ assertFalse(s.getMessage().equals("ok"));
+ assertFalse(s.getException() == null);
+ }
+
+ public void testCreateNotSerializableExceptionStatus() throws Exception {
+ IStatus s = createNotSerializableExceptionStatus();
+ assertNotNull(s);
+ assertFalse(s.isOK());
+ assertTrue(s.getCode() == IStatus.ERROR);
+ assertFalse(s.getMessage().equals("ok"));
+ assertFalse(s.getException() == null);
+ Throwable t = s.getException();
+ assertFalse(t instanceof MyNotSerializableException);
+ }
+}

Back to the top