blob: 65195084ade0fad156fb1ad75f478505087a7a5a [file] [log] [blame]
Jonathan Hartaa380972014-04-03 10:24:46 -07001package net.onrc.onos.core.intent;
Toshio Koideeb2d9e52014-03-31 17:52:34 -07002
Jonathan Harta88fd242014-04-03 11:24:54 -07003import static org.junit.Assert.assertEquals;
Ray Milkey269ffb92014-04-03 14:43:30 -07004
Jonathan Hartaa380972014-04-03 10:24:46 -07005import net.onrc.onos.core.intent.IntentOperation.Operator;
Toshio Koideeb2d9e52014-03-31 17:52:34 -07006
7import org.junit.After;
8import org.junit.Before;
9import org.junit.Test;
10
11/**
12 * Unit tests for the IntentOperation class.
Ray Milkey269ffb92014-04-03 14:43:30 -070013 *
Toshio Koideeb2d9e52014-03-31 17:52:34 -070014 * @author Toshio Koide (t-koide@onlab.us)
15 */
16public class IntentOperationTest {
17
18 @Before
19 public void setUp() throws Exception {
20 }
21
22 @After
23 public void tearDown() throws Exception {
24 }
25
26 /**
27 * Test the result of executing constructor of the IntentOperation class.
28 * This test checks the id field and the operator field.
29 */
30 @Test
31 public void testCreate() {
32 IntentOperation op1 = new IntentOperation(Operator.ADD, new Intent("1"));
33 IntentOperation op2 = new IntentOperation(Operator.REMOVE, new Intent("2"));
34 IntentOperation op3 = new IntentOperation(Operator.ERROR, new Intent("3"));
35
36 assertEquals("1", op1.intent.getId());
37 assertEquals(Operator.ADD, op1.operator);
38 assertEquals("2", op2.intent.getId());
39 assertEquals(Operator.REMOVE, op2.operator);
40 assertEquals("3", op3.intent.getId());
41 assertEquals(Operator.ERROR, op3.operator);
42 }
43}