blob: a537dc8732f811dda59e8f7ad6aafe0ad3593eec [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
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 */
tomca20e0c2014-09-03 23:22:24 -070016package org.onlab.onos.net;
17
tomca20e0c2014-09-03 23:22:24 -070018import static org.junit.Assert.assertEquals;
19import static org.onlab.onos.net.PortNumber.portNumber;
20
alshabib4680bb62014-09-04 17:15:08 -070021import org.junit.Test;
22
23import com.google.common.testing.EqualsTester;
24
tomca20e0c2014-09-03 23:22:24 -070025/**
26 * Test of the port number.
27 */
tom545708e2014-10-09 17:10:02 -070028public class PortNumberTest {
tomca20e0c2014-09-03 23:22:24 -070029
30 @Test
31 public void basics() {
32 new EqualsTester()
alshabib4680bb62014-09-04 17:15:08 -070033 .addEqualityGroup(portNumber(123),
34 portNumber("123"))
tomca20e0c2014-09-03 23:22:24 -070035 .addEqualityGroup(portNumber(321))
36 .testEquals();
37 }
38
39 @Test
40 public void number() {
41 assertEquals("incorrect long value", 12345, portNumber(12345).toLong());
42 }
43
tomca20e0c2014-09-03 23:22:24 -070044
tomca20e0c2014-09-03 23:22:24 -070045}