Package org.dhcp4java

Examples of org.dhcp4java.HardwareAddress


      pac0.setFileRaw(new byte[129]);
    }
   
    @Test
    public void testGetHardwareAddress() {
        HardwareAddress ha = new HardwareAddress(HTYPE_ETHER, "001122334455");
        assertEquals(ha, refPacketFromSratch.getHardwareAddress());
        DHCPPacket pac2 = refPacketFromSratch.clone();
        pac2.setHlen((byte)17);
        HardwareAddress ha2 = new HardwareAddress(HTYPE_ETHER, "00112233445566778899AABBCCDDEEFF");
        assertEquals(ha2, pac2.getHardwareAddress());
    }
View Full Code Here


  public void testConstructor() {
    assertEquals(DHCPConstants.HTYPE_ETHER, ha.getHardwareType());
    assertEquals("001122334455", ha.getHardwareAddressHex());
    assertTrue(Arrays.equals(HexUtils.hexToBytes("001122334455"), ha.getHardwareAddress()));
   
    HardwareAddress ha2 = new HardwareAddress(DHCPConstants.HTYPE_ETHER, HexUtils.hexToBytes("001122334455"));
    assertEquals(ha, ha2);
    HardwareAddress ha3 = new HardwareAddress(HexUtils.hexToBytes("001122334455"));
    assertEquals(ha, ha3);
    HardwareAddress ha4 = new HardwareAddress("001122334455");
    assertEquals(ha, ha4);
    HardwareAddress ha5 = new HardwareAddress(DHCPConstants.HTYPE_FDDI, HexUtils.hexToBytes("001122334455"));
    assertFalse(ha.equals(ha5));
   
    assertTrue(ha.hashCode() != 0);
    assertEquals(ha.hashCode(), ha2.hashCode());
    assertEquals(ha.hashCode(), ha3.hashCode());
    assertEquals(ha.hashCode(), ha4.hashCode());
    assertTrue(ha.hashCode() != ha5.hashCode());
   
    assertFalse(ha.equals(null));
    assertFalse(ha.equals(new Object()));
  }
View Full Code Here

  }
 
  @Test
  public void testToString() {
    assertEquals("00:11:22:33:44:55", ha.toString());
    HardwareAddress ha2 = new HardwareAddress(DHCPConstants.HTYPE_FDDI, "0011045508");
    assertEquals("8/00:11:04:55:08", ha2.toString());
  }
View Full Code Here

    assertEquals("8/00:11:04:55:08", ha2.toString());
  }
 
  @Test
  public void testGetHardwareAddressByString() {
    HardwareAddress ha2 = new HardwareAddress("0011045508FF");
    HardwareAddress ha3 = HardwareAddress.getHardwareAddressByString("0:11:4:55:8:Ff");
    assertEquals(ha2, ha3);
  }
View Full Code Here

TOP

Related Classes of org.dhcp4java.HardwareAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.