2 * Copyright 2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onosproject.vtnrsc.virtualport;
19 import static org.hamcrest.MatcherAssert.assertThat;
20 import static org.hamcrest.Matchers.is;
21 import static org.hamcrest.Matchers.notNullValue;
22 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
24 import org.junit.Test;
25 import org.onosproject.vtnrsc.SecurityGroup;
27 import com.google.common.testing.EqualsTester;
30 * Unit tests for SecurityGroup class.
32 public class SecurityGroupTest {
34 final SecurityGroup securityGroup1 = SecurityGroup.securityGroup("1");
35 final SecurityGroup sameAssecurityGroup = SecurityGroup.securityGroup("1");
36 final SecurityGroup securityGroup2 = SecurityGroup.securityGroup("2");
39 * Checks that the SecurityGroup class is immutable.
42 public void testImmutability() {
43 assertThatClassIsImmutable(SecurityGroup.class);
47 * Checks the operation of equals().
50 public void testEquals() {
51 new EqualsTester().addEqualityGroup(securityGroup1, sameAssecurityGroup)
52 .addEqualityGroup(securityGroup2).testEquals();
56 * Checks the construction of a SecurityGroup object.
59 public void testConstruction() {
60 final String securityGroupValue = "1";
61 final SecurityGroup securityGroup = SecurityGroup.securityGroup(securityGroupValue);
62 assertThat(securityGroup, is(notNullValue()));
63 assertThat(securityGroup.securityGroup(), is(securityGroupValue));