Open Kilda Java Documentation
InstallTransitFlowTest.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.command.flow;
17 
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotNull;
26 
27 import org.junit.Test;
28 
29 public class InstallTransitFlowTest {
30  private InstallTransitFlow flow = new InstallTransitFlow(0L,
31  flowName, 0L, switchId, inputPort, outputPort, transitVlanId);
32 
33  @Test
34  public void toStringTest() throws Exception {
35  String flowString = flow.toString();
36  assertNotNull(flowString);
37  assertFalse(flowString.isEmpty());
38  }
39 
40  @Test
41  public void getTransitVlanId() throws Exception {
42  assertEquals(transitVlanId, flow.getTransitVlanId().intValue());
43  }
44 
45  @Test
46  public void setTransitVlanId() throws Exception {
47  flow.setTransitVlanId(transitVlanId);
48  assertEquals(transitVlanId, flow.getTransitVlanId().intValue());
49  }
50 
51  @Test(expected = IllegalArgumentException.class)
52  public void setNullTransitVlanId() throws Exception {
53  flow.setTransitVlanId(null);
54  }
55 
56  @Test(expected = IllegalArgumentException.class)
57  public void setZeroTransitVlanId() throws Exception {
58  flow.setTransitVlanId(0);
59  }
60 
61  @Test(expected = IllegalArgumentException.class)
62  public void setTooBigTransitVlanId() throws Exception {
63  flow.setTransitVlanId(4096);
64  }
65 }