Package org.dhcp4java

Examples of org.dhcp4java.InetCidr


       return new JUnit4TestAdapter(InetCidrTest.class);
    }
 
  @Test
  public void testConstructor() throws Exception {
    InetCidr cidr = new InetCidr(InetAddress.getByName("224.17.252.127"), 24);
    assertEquals(InetAddress.getByName("224.17.252.0"), cidr.getAddr());
    assertEquals(24, cidr.getMask());
   
  }
View Full Code Here


    assertEquals(24, cidr.getMask());
   
  }
  @Test (expected=NullPointerException.class)
  public void testConstructorBadArgNull() {
    new InetCidr(null, 20);
  }
View Full Code Here

    new InetCidr(null, 20);
  }
 
  @Test (expected=IllegalArgumentException.class)
  public void testConstructorBadArgIPv6() throws Exception {
    new InetCidr(InetAddress.getByName("1080:0:0:0:8:800:200C:417A"), 20);
  }
View Full Code Here

  public void testConstructorBadArgIPv6() throws Exception {
    new InetCidr(InetAddress.getByName("1080:0:0:0:8:800:200C:417A"), 20);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testConstructorBadArgMaskTooSmall() throws Exception {
    new InetCidr(InetAddress.getByName("16.17.18.19"), 0);
  }
View Full Code Here

  public void testConstructorBadArgMaskTooSmall() throws Exception {
    new InetCidr(InetAddress.getByName("16.17.18.19"), 0);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testConstructorBadArgMaskTooBig() throws Exception {
    new InetCidr(InetAddress.getByName("16.17.18.19"), 33);
  }
View Full Code Here

    new InetCidr(InetAddress.getByName("16.17.18.19"), 33);
  }
 
  @Test
  public void testConstructor2() throws Exception {
    InetCidr cidr0 = new InetCidr(InetAddress.getByName("10.11.12.0"), 24);
    InetCidr cidr1 = new InetCidr(InetAddress.getByName("10.11.12.0"), InetAddress.getByName("255.255.255.0"));
    assertEquals(cidr0, cidr1);
  }
View Full Code Here

    InetCidr cidr1 = new InetCidr(InetAddress.getByName("10.11.12.0"), InetAddress.getByName("255.255.255.0"));
    assertEquals(cidr0, cidr1);
  }
  @Test (expected=NullPointerException.class)
  public void testConstructorBadArgNull2() {
    new InetCidr(null, null);
  }
View Full Code Here

  public void testConstructorBadArgNull2() {
    new InetCidr(null, null);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testConstructorBadArgIPv62() throws Exception {
    new InetCidr(InetAddress.getByName("1080:0:0:0:8:800:200C:417A"), InetAddress.getByName("255.255.255.0"));
  }
View Full Code Here

  public void testConstructorBadArgIPv62() throws Exception {
    new InetCidr(InetAddress.getByName("1080:0:0:0:8:800:200C:417A"), InetAddress.getByName("255.255.255.0"));
  }
  @Test (expected=IllegalArgumentException.class)
  public void testConstructorBadArgMask() throws Exception {
    new InetCidr(InetAddress.getByName("10.11.12.0"), InetAddress.getByName("255.255.255.12"));
  }
View Full Code Here

  }

  @Test
  public void testAddrmask2CidrGood() {
    InetAddress ip = Util.int2InetAddress(0x12345678);
    InetCidr cidr1 = new InetCidr(ip, 30);
    InetCidr cidr2 = new InetCidr(ip, Util.int2InetAddress(0xFFFFFFFC));
    assertEquals(cidr1, cidr2);
  }
View Full Code Here

TOP

Related Classes of org.dhcp4java.InetCidr

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.