Sho SHIMIZU | ec4f5a7 | 2014-07-21 18:21:23 -0700 | [diff] [blame^] | 1 | package net.onrc.onos.api.intent; |
| 2 | |
| 3 | import org.junit.Test; |
| 4 | |
| 5 | import static net.onrc.onos.core.util.ImmutableClassChecker.assertThatClassIsImmutable; |
| 6 | import static org.hamcrest.Matchers.is; |
| 7 | import static org.hamcrest.Matchers.not; |
| 8 | import static org.junit.Assert.assertThat; |
| 9 | |
| 10 | /** |
| 11 | * This class tests the immutability, equality, and non-equality of {@link IntentId}. |
| 12 | */ |
| 13 | public 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 | } |