blob: fb563c3a35a6ce093096f503c52f18c7171914ec [file] [log] [blame]
Sho SHIMIZUec4f5a72014-07-21 18:21:23 -07001package net.onrc.onos.api.intent;
2
3import org.junit.Test;
4
5import static net.onrc.onos.core.util.ImmutableClassChecker.assertThatClassIsImmutable;
6import static org.hamcrest.Matchers.is;
7import static org.hamcrest.Matchers.not;
8import static org.junit.Assert.assertThat;
9
10/**
11 * This class tests the immutability, equality, and non-equality of {@link IntentId}.
12 */
13public class IntentIdTest {
14 /**
15 * Tests the immutability of {@link IntentId}.
16 */
17 @Test
18 public void intentIdFollowsGuidelineForImmutableObject() {
19 assertThatClassIsImmutable(IntentId.class);
20 }
21
22 /**
23 * Tests equality of {@link IntentId}.
24 */
25 @Test
26 public void testEquality() {
27 IntentId id1 = new IntentId(1L);
28 IntentId id2 = new IntentId(1L);
29
30 assertThat(id1, is(id2));
31 }
32
33 /**
34 * Tests non-equality of {@link IntentId}.
35 */
36 @Test
37 public void testNonEquality() {
38 IntentId id1 = new IntentId(1L);
39 IntentId id2 = new IntentId(2L);
40
41 assertThat(id1, is(not(id2)));
42 }
43}