1 package org.openflow.util;
3 import junit.framework.TestCase;
6 * Does hexstring conversion work?
8 * @author Rob Sherwood (rob.sherwood@stanford.edu)
12 public class HexStringTest extends TestCase {
14 public void testMarshalling() throws Exception {
15 String dpidStr = "00:00:00:23:20:2d:16:71";
16 long dpid = HexString.toLong(dpidStr);
17 String testStr = HexString.toHexString(dpid);
18 TestCase.assertEquals(dpidStr, testStr);
21 public void testToStringBytes() {
22 byte[] dpid = { 0, 0, 0, 0, 0, 0, 0, -1 };
23 String valid = "00:00:00:00:00:00:00:ff";
24 String testString = HexString.toHexString(dpid);
25 TestCase.assertEquals(valid, testString);