blob: 5aebec6777cbb567d84d8d5b8de1625c76a02da3 [file] [log] [blame]
samueljcc8d55cf62015-10-28 16:00:01 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
samueljcc8d55cf62015-10-28 16:00:01 -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.
15 */
16
Ray Milkey6c1bac32015-11-13 14:40:40 -080017package org.onosproject.vtnrsc;
18
19import org.junit.Test;
20
21import com.google.common.testing.EqualsTester;
samueljcc8d55cf62015-10-28 16:00:01 -070022
23import static org.hamcrest.MatcherAssert.assertThat;
24import static org.hamcrest.Matchers.is;
25import static org.hamcrest.Matchers.notNullValue;
26import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
27
samueljcc8d55cf62015-10-28 16:00:01 -070028/**
29 * Unit tests for SecurityGroup class.
30 */
31public class SecurityGroupTest {
32
33 final SecurityGroup securityGroup1 = SecurityGroup.securityGroup("1");
34 final SecurityGroup sameAssecurityGroup = SecurityGroup.securityGroup("1");
35 final SecurityGroup securityGroup2 = SecurityGroup.securityGroup("2");
36
37 /**
38 * Checks that the SecurityGroup class is immutable.
39 */
40 @Test
41 public void testImmutability() {
42 assertThatClassIsImmutable(SecurityGroup.class);
43 }
44
45 /**
46 * Checks the operation of equals().
47 */
48 @Test
49 public void testEquals() {
50 new EqualsTester().addEqualityGroup(securityGroup1, sameAssecurityGroup)
51 .addEqualityGroup(securityGroup2).testEquals();
52 }
53
54 /**
55 * Checks the construction of a SecurityGroup object.
56 */
57 @Test
58 public void testConstruction() {
59 final String securityGroupValue = "1";
60 final SecurityGroup securityGroup = SecurityGroup.securityGroup(securityGroupValue);
61 assertThat(securityGroup, is(notNullValue()));
62 assertThat(securityGroup.securityGroup(), is(securityGroupValue));
63
64 }
65}