Toshio Koide | eb2d9e5 | 2014-03-31 17:52:34 -0700 | [diff] [blame] | 1 | package net.onrc.onos.intent; |
| 2 | |
| 3 | import static org.junit.Assert.*; |
| 4 | import net.onrc.onos.intent.ErrorIntent.ErrorType; |
| 5 | |
| 6 | import org.junit.After; |
| 7 | import org.junit.Before; |
| 8 | import org.junit.Test; |
| 9 | |
| 10 | /** |
| 11 | * Unit tests for the ErrorIntent class. |
| 12 | * @author Toshio Koide (t-koide@onlab.us) |
| 13 | */ |
| 14 | public 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 | } |