Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 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 | */ |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 16 | package org.onosproject.net.flow; |
| 17 | |
| 18 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 19 | |
| 20 | import org.junit.Test; |
| 21 | |
| 22 | import com.google.common.testing.EqualsTester; |
| 23 | /** |
| 24 | * Test for FlowRuleExtPayLoad. |
| 25 | */ |
| 26 | public class FlowRuleExtPayLoadTest { |
| 27 | final byte[] b = new byte[3]; |
| 28 | final byte[] b1 = new byte[5]; |
| 29 | final FlowRuleExtPayLoad payLoad1 = FlowRuleExtPayLoad.flowRuleExtPayLoad(b); |
| 30 | final FlowRuleExtPayLoad sameAsPayLoad1 = FlowRuleExtPayLoad.flowRuleExtPayLoad(b); |
| 31 | final FlowRuleExtPayLoad payLoad2 = FlowRuleExtPayLoad.flowRuleExtPayLoad(b1); |
| 32 | |
| 33 | /** |
| 34 | * Checks that the FlowRuleExtPayLoad class is immutable. |
| 35 | */ |
| 36 | @Test |
| 37 | public void testImmutability() { |
| 38 | assertThatClassIsImmutable(FlowRuleExtPayLoad.class); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Checks the operation of equals(), hashCode() and toString() methods. |
| 43 | */ |
| 44 | @Test |
| 45 | public void testEquals() { |
| 46 | new EqualsTester() |
| 47 | .addEqualityGroup(payLoad1, sameAsPayLoad1) |
| 48 | .addEqualityGroup(payLoad2) |
| 49 | .testEquals(); |
| 50 | } |
| 51 | } |