blob: c10b9b5692efc40dc144ccc66747699a52c136bd [file] [log] [blame]
Toshio Koideeb2d9e52014-03-31 17:52:34 -07001package net.onrc.onos.intent;
2
3import static org.junit.Assert.*;
4import net.onrc.onos.intent.ErrorIntent.ErrorType;
5
6import org.junit.After;
7import org.junit.Before;
8import org.junit.Test;
9
10/**
11 * Unit tests for the ErrorIntent class.
12 * @author Toshio Koide (t-koide@onlab.us)
13 */
14public class ErrorIntentTest {
15
16 @Before
17 public void setUp() throws Exception {
18 }
19
20 @After
21 public void tearDown() throws Exception {
22 }
23
24 /**
25 * Test the result of executing constructor of the ErrorIntent class.
26 * This test checks the fields of id, errorType, message and parentIntent.
27 */
28 @Test
29 public void testCreate() {
30 Intent parentIntent = new Intent("1");
31 ErrorIntent errorIntent = new ErrorIntent(ErrorType.PATH_NOT_FOUND, "path not found", parentIntent);
32
33 assertEquals("1", errorIntent.getId());
34 assertEquals(ErrorType.PATH_NOT_FOUND, errorIntent.errorType);
35 assertEquals("path not found", errorIntent.message);
36 assertEquals(parentIntent, errorIntent.parentIntent);
37 }
38}