blob: 0ab8eb9bc30b4d7622fbc14064558de5ddf2a6a4 [file] [log] [blame]
Frank Wange33e4ed2017-06-28 10:01:07 +08001/*
2 * Copyright 2017-present 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
17package org.onosproject.net.pi.model;
18
19
20import com.google.common.testing.EqualsTester;
21import org.junit.Test;
22
23import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
24
25/**
26 * Unit tests for PiPipeconfId class.
27 */
28public class PiPipeconfIdTest {
29 final String id1 = "pipeline1";
30 final String id2 = "pipeline2";
31 final PiPipeconfId piPipeconfId1 = new PiPipeconfId(id1);
32 final PiPipeconfId sameAsPiPipeconfId1 = new PiPipeconfId(id1);
33 final PiPipeconfId piPipeconfId2 = new PiPipeconfId(id2);
34
35 /**
36 * Checks that the PiPipeconfId class is immutable.
37 */
38 @Test
39 public void testImmutability() {
40 assertThatClassIsImmutable(PiPipeconfId.class);
41 }
42
43 /**
44 * Checks the operation of equals(), hashCode() and toString() methods.
45 */
46 @Test
47 public void testEquals() {
48 new EqualsTester()
49 .addEqualityGroup(piPipeconfId1, sameAsPiPipeconfId1)
50 .addEqualityGroup(piPipeconfId2)
51 .testEquals();
52 }
53}