blob: 6f7b2c2d6988f0d6662e04a8248e9067db5727c6 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net;
tomca20e0c2014-09-03 23:22:24 -070017
Marc De Leenheer171c2e82015-04-13 17:20:37 -070018import com.google.common.testing.EqualsTester;
alshabib4680bb62014-09-04 17:15:08 -070019import org.junit.Test;
20
Marc De Leenheer171c2e82015-04-13 17:20:37 -070021import static org.junit.Assert.assertEquals;
22import static org.onosproject.net.PortNumber.portNumber;
alshabib4680bb62014-09-04 17:15:08 -070023
tomca20e0c2014-09-03 23:22:24 -070024/**
25 * Test of the port number.
26 */
tom545708e2014-10-09 17:10:02 -070027public class PortNumberTest {
tomca20e0c2014-09-03 23:22:24 -070028
29 @Test
30 public void basics() {
31 new EqualsTester()
Marc De Leenheer171c2e82015-04-13 17:20:37 -070032 .addEqualityGroup(portNumber(123), portNumber("123"))
33 .addEqualityGroup(portNumber(321), portNumber(321, "LIM-3-2-1"))
tomca20e0c2014-09-03 23:22:24 -070034 .testEquals();
35 }
36
37 @Test
38 public void number() {
39 assertEquals("incorrect long value", 12345, portNumber(12345).toLong());
40 }
41
tomca20e0c2014-09-03 23:22:24 -070042
tomca20e0c2014-09-03 23:22:24 -070043}