blob: bb40279cdbb7ebfaebc794002d6a35f02af7d8fd [file] [log] [blame]
Simon Huntd6685d02015-08-21 09:56:06 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18package org.onosproject.ui.topo;
19
20import org.junit.Test;
21
22import static org.junit.Assert.*;
23
24/**
25 * Unit tests for {@link Mod}.
26 */
27public class ModTest {
28
29 private static final String AAA = "aaa";
30 private static final String BBB = "bbb";
31
32 private Mod mod1;
33 private Mod mod2;
34
35 @Test(expected = NullPointerException.class)
36 public void nullId() {
37 new Mod(null);
38 }
39
40 @Test
41 public void basic() {
42 mod1 = new Mod(AAA);
43 assertEquals("wrong id", AAA, mod1.toString());
44 }
45
46 @Test
47 public void equivalence() {
48 mod1 = new Mod(AAA);
49 mod2 = new Mod(AAA);
50 assertNotSame("oops", mod1, mod2);
51 assertEquals("not equivalent", mod1, mod2);
52 }
53
54 @Test
55 public void comparable() {
56 mod1 = new Mod(AAA);
57 mod2 = new Mod(BBB);
58 assertNotEquals("what?", mod1, mod2);
59 assertTrue(mod1.compareTo(mod2) < 0);
60 assertTrue(mod2.compareTo(mod1) > 0);
61 }
62}