Examples of DHCPOption


Examples of org.dhcp4java.DHCPOption

    assertFalse(opt1.equals(new Integer(1)));
    assertFalse(opt1.equals(new DHCPOption(DHO_BOOTFILE, null)));
  }
  @Test
  public void testEqualsNull() {
    DHCPOption opt1 = new DHCPOption(DHO_BOOTFILE, null);
    DHCPOption opt2 = new DHCPOption(DHO_BOOTFILE, null);
   
    assertTrue(opt1.equals(opt1));
    assertTrue(opt1.equals(opt2));
    assertTrue(opt2.equals(opt1));
    assertFalse(opt1.equals(null));
    assertFalse(opt1.equals(new Integer(1)));
    assertFalse(opt1.equals(new DHCPOption(DHO_BOOTFILE, buf0)));
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    assertFalse(opt1.equals(new Integer(1)));
    assertFalse(opt1.equals(new DHCPOption(DHO_BOOTFILE, buf0)));
  }
  @Test
  public void testEqualsMirror() {
    DHCPOption opt1 = new DHCPOption(DHO_BOOTFILE, null);
    DHCPOption opt2 = new DHCPOption(DHO_BOOTFILE, null, false);
    DHCPOption opt3 = new DHCPOption(DHO_BOOTFILE, null, true);
    DHCPOption opt4 = new DHCPOption(DHO_BOOTFILE, null, true);
   
    assertTrue(opt1.equals(opt1));
    assertTrue(opt1.equals(opt2));
    assertTrue(opt2.equals(opt1));
   
    assertTrue(opt3.equals(opt3));
    assertTrue(opt3.equals(opt4));
    assertTrue(opt4.equals(opt3));
   
    assertFalse(opt1.equals(opt3));
    assertFalse(opt3.equals(opt1));
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    assertFalse(opt3.equals(opt1));
  }
 
  @Test
  public void testHashCode() {
    DHCPOption opt1 = new DHCPOption(DHO_BOOTFILE, buf0);
    DHCPOption opt2 = new DHCPOption(DHO_DHCP_MESSAGE, buf0);
    assertTrue(opt1.hashCode() != 0);
    assertTrue(opt1.hashCode() != opt2.hashCode());
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    assertTrue(opt1.hashCode() != opt2.hashCode());
  }
 
  @Test
  public void testToString() {
    DHCPOption opt1 = new DHCPOption(DHO_BOOTFILE, buf0);
    assertEquals(opt1.toString(), "DHO_BOOTFILE(67)=\"foobar\"");
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

  // high level static constructors
 
  // Byte
  @Test
  public void testNewOptionAsByteGetValueAsByte() {
    DHCPOption opt = DHCPOption.newOptionAsByte(DHO_IP_FORWARDING, (byte)1);
    assertEquals(opt.getCode(), DHO_IP_FORWARDING);
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("01")));
   
    assertEquals(opt.getValueAsByte(), (byte) 1);
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

  public void testNewOptionAsByteBad() {
    DHCPOption.newOptionAsByte(DHO_DHCP_LEASE_TIME, (byte) 0);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsByteBad() {
    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsByte();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsByte();
  }
  @Test (expected=IllegalStateException.class)
  public void testGetValueAsByteIllegalState() {
    DHCPOption opt = new DHCPOption(DHO_IP_FORWARDING, null);
    opt.getValueAsByte();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_IP_FORWARDING, null);
    opt.getValueAsByte();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsByteBadSize2() {
    DHCPOption opt = new DHCPOption(DHO_IP_FORWARDING, new byte[2]);
    opt.getValueAsByte();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

  }
 
  // Short
  @Test
  public void testNewOptionAsShortGetValueAsShort() {
    DHCPOption opt = DHCPOption.newOptionAsShort(DHO_INTERFACE_MTU, (short)1500);
    assertEquals(opt.getCode(), DHO_INTERFACE_MTU);
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("05DC")));
   
    assertEquals(opt.getValueAsShort(), (short) 1500);
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

  public void testNewOptionAsShortBad() {
    DHCPOption.newOptionAsShort(DHO_DHCP_LEASE_TIME, (short) 0);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsShortBad() {
    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsShort();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.