Add unit test code for ErrorIntent and IntentOperation class.
Change-Id: Id87e1b01b8aeed25c1e8e87e947d1cf864571388
diff --git a/src/test/java/net/onrc/onos/intent/ErrorIntentTest.java b/src/test/java/net/onrc/onos/intent/ErrorIntentTest.java
new file mode 100644
index 0000000..c10b9b5
--- /dev/null
+++ b/src/test/java/net/onrc/onos/intent/ErrorIntentTest.java
@@ -0,0 +1,38 @@
+package net.onrc.onos.intent;
+
+import static org.junit.Assert.*;
+import net.onrc.onos.intent.ErrorIntent.ErrorType;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit tests for the ErrorIntent class.
+ * @author Toshio Koide (t-koide@onlab.us)
+ */
+public class ErrorIntentTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test the result of executing constructor of the ErrorIntent class.
+ * This test checks the fields of id, errorType, message and parentIntent.
+ */
+ @Test
+ public void testCreate() {
+ Intent parentIntent = new Intent("1");
+ ErrorIntent errorIntent = new ErrorIntent(ErrorType.PATH_NOT_FOUND, "path not found", parentIntent);
+
+ assertEquals("1", errorIntent.getId());
+ assertEquals(ErrorType.PATH_NOT_FOUND, errorIntent.errorType);
+ assertEquals("path not found", errorIntent.message);
+ assertEquals(parentIntent, errorIntent.parentIntent);
+ }
+}