blob: 534602e5c6ac6770e7debae3ef5e01adb87e59ee [file] [log] [blame]
Simon Huntd6685d02015-08-21 09:56:06 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Simon Huntd6685d02015-08-21 09:56:06 -07003 *
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.
Simon Huntd6685d02015-08-21 09:56:06 -070015 */
16
17package org.onosproject.ui.topo;
18
19import org.junit.Test;
20
21import static org.junit.Assert.*;
22
23/**
24 * Unit tests for {@link Mod}.
25 */
26public class ModTest {
27
28 private static final String AAA = "aaa";
29 private static final String BBB = "bbb";
30
31 private Mod mod1;
32 private Mod mod2;
33
34 @Test(expected = NullPointerException.class)
35 public void nullId() {
36 new Mod(null);
37 }
38
39 @Test
40 public void basic() {
41 mod1 = new Mod(AAA);
42 assertEquals("wrong id", AAA, mod1.toString());
43 }
44
45 @Test
46 public void equivalence() {
47 mod1 = new Mod(AAA);
48 mod2 = new Mod(AAA);
49 assertNotSame("oops", mod1, mod2);
50 assertEquals("not equivalent", mod1, mod2);
51 }
52
53 @Test
54 public void comparable() {
55 mod1 = new Mod(AAA);
56 mod2 = new Mod(BBB);
57 assertNotEquals("what?", mod1, mod2);
58 assertTrue(mod1.compareTo(mod2) < 0);
59 assertTrue(mod2.compareTo(mod1) > 0);
60 }
61}