Jonathan Hart | aa38097 | 2014-04-03 10:24:46 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.intent; |
Toshio Koide | eb2d9e5 | 2014-03-31 17:52:34 -0700 | [diff] [blame] | 2 | |
Jonathan Hart | a88fd24 | 2014-04-03 11:24:54 -0700 | [diff] [blame] | 3 | import static org.junit.Assert.assertEquals; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 4 | |
Jonathan Hart | aa38097 | 2014-04-03 10:24:46 -0700 | [diff] [blame] | 5 | import net.onrc.onos.core.intent.IntentOperation.Operator; |
Toshio Koide | eb2d9e5 | 2014-03-31 17:52:34 -0700 | [diff] [blame] | 6 | |
| 7 | import org.junit.After; |
| 8 | import org.junit.Before; |
| 9 | import org.junit.Test; |
| 10 | |
| 11 | /** |
| 12 | * Unit tests for the IntentOperation class. |
Toshio Koide | eb2d9e5 | 2014-03-31 17:52:34 -0700 | [diff] [blame] | 13 | */ |
| 14 | public class IntentOperationTest { |
| 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 IntentOperation class. |
| 26 | * This test checks the id field and the operator field. |
| 27 | */ |
| 28 | @Test |
| 29 | public void testCreate() { |
| 30 | IntentOperation op1 = new IntentOperation(Operator.ADD, new Intent("1")); |
| 31 | IntentOperation op2 = new IntentOperation(Operator.REMOVE, new Intent("2")); |
| 32 | IntentOperation op3 = new IntentOperation(Operator.ERROR, new Intent("3")); |
| 33 | |
| 34 | assertEquals("1", op1.intent.getId()); |
| 35 | assertEquals(Operator.ADD, op1.operator); |
| 36 | assertEquals("2", op2.intent.getId()); |
| 37 | assertEquals(Operator.REMOVE, op2.operator); |
| 38 | assertEquals("3", op3.intent.getId()); |
| 39 | assertEquals(Operator.ERROR, op3.operator); |
| 40 | } |
| 41 | } |