blob: 4645664b5648c1ef7bef0742b1c280dbeb464554 [file] [log] [blame]
Charles Chan64c2dfd2018-07-24 11:58:08 -07001/*
2 * Copyright 2018-present Open Networking Foundation
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.onlab.packet.lacp;
18
19import org.junit.Test;
20
21import static org.junit.Assert.*;
22
23public class LacpStateTest {
24
25 @Test
26 public void toByte() {
27 LacpState state = new LacpState((byte) 0x15);
28 assertEquals((byte) 0x15, state.toByte());
29 }
30
31 @Test
32 public void isActive() {
33 LacpState state = new LacpState((byte) 0x1);
34 assertTrue(state.isActive());
35 }
36
37 @Test
38 public void isTimeout() {
39 LacpState state = new LacpState((byte) 0x2);
40 assertTrue(state.isTimeout());
41 }
42
43 @Test
44 public void isAggregatable() {
45 LacpState state = new LacpState((byte) 0x4);
46 assertTrue(state.isAggregatable());
47 }
48
49 @Test
50 public void isSync() {
51 LacpState state = new LacpState((byte) 0x8);
52 assertTrue(state.isSync());
53 }
54
55 @Test
56 public void isCollecting() {
57 LacpState state = new LacpState((byte) 0x10);
58 assertTrue(state.isCollecting());
59 }
60
61 @Test
62 public void isDistributing() {
63 LacpState state = new LacpState((byte) 0x20);
64 assertTrue(state.isDistributing());
65 }
66
67 @Test
68 public void isDefault() {
69 LacpState state = new LacpState((byte) 0x40);
70 assertTrue(state.isDefault());
71 }
72
73 @Test
74 public void isExpired() {
75 LacpState state = new LacpState((byte) 0x80);
76 assertTrue(state.isExpired());
77 }
78
79 @Test
80 public void equals() {
81 LacpState state1 = new LacpState((byte) 0x15);
82 LacpState state2 = new LacpState((byte) 0x15);
83 LacpState state3 = new LacpState((byte) 0x51);
84
85 assertEquals(state1, state2);
86 assertNotEquals(state1, state3);
87
88 }
89}