Initial opendaylight infrastructure commit!!
[controller.git] / third-party / openflowj / src / test / java / org / openflow / util / HexStringTest.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.openflow.util;
11
12 import junit.framework.TestCase;
13
14 /**
15  * Does hexstring conversion work?
16  * 
17  * @author Rob Sherwood (rob.sherwood@stanford.edu)
18  * 
19  */
20
21 public class HexStringTest extends TestCase {
22
23     public void testMarshalling() throws Exception {
24         String dpidStr = "00:00:00:23:20:2d:16:71";
25         long dpid = HexString.toLong(dpidStr);
26         String testStr = HexString.toHexString(dpid);
27         TestCase.assertEquals(dpidStr, testStr);
28     }
29
30     public void testToStringBytes() {
31         byte[] dpid = { 0, 0, 0, 0, 0, 0, 0, -1 };
32         String valid = "00:00:00:00:00:00:00:ff";
33         String testString = HexString.toHexString(dpid);
34         TestCase.assertEquals(valid, testString);
35     }
36 }