3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
10 package org.openflow.util;
12 import junit.framework.TestCase;
15 * Does hexstring conversion work?
17 * @author Rob Sherwood (rob.sherwood@stanford.edu)
21 public class HexStringTest extends TestCase {
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);
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);