Package org.dhcp4java

Examples of org.dhcp4java.InetCidr


    assertEquals(-1, cidr1.compareTo(cidr7));
  }
 
  @Test
  public void testIsInetCidrListSorted() throws Exception {
    InetCidr cidr1 = new InetCidr(InetAddress.getByName("10.11.12.0"), 24);
//    InetCidr cidr2 = new InetCidr(InetAddress.getByName("10.11.12.0"), 23);
    InetCidr cidr3 = new InetCidr(InetAddress.getByName("10.11.12.0"), 25);
//    InetCidr cidr4 = new InetCidr(InetAddress.getByName("10.11.11.0"), 24);
    InetCidr cidr5 = new InetCidr(InetAddress.getByName("10.11.13.0"), 24);
//    InetCidr cidr6 = new InetCidr(InetAddress.getByName("11.11.12.0"), 24);
    InetCidr cidr7 = new InetCidr(InetAddress.getByName("129.11.12.0"), 24);
   
    assertEquals(true, InetCidr.isSorted(null));
    List<InetCidr> list1 = new ArrayList<InetCidr>();
    list1.add(cidr1);
    list1.add(cidr3);
View Full Code Here


    InetCidr.isSorted(list1);
  }
 
  @Test (expected=NullPointerException.class)
  public void testCompareToNull() throws UnknownHostException {
    InetCidr cidr1 = new InetCidr(InetAddress.getByName("10.11.12.0"), 24);
    cidr1.compareTo(null);
  }
View Full Code Here

    cidr1.compareTo(null);
  }
 
  @Test
  public void testHasNoOverlap() throws UnknownHostException {
    InetCidr cidr1 = new InetCidr(InetAddress.getByName("10.11.12.0"), 24);
    InetCidr cidr2 = new InetCidr(InetAddress.getByName("10.11.12.0"), 23);
    InetCidr cidr3 = new InetCidr(InetAddress.getByName("10.11.12.0"), 25);
//    InetCidr cidr4 = new InetCidr(InetAddress.getByName("10.11.11.0"), 24);
    InetCidr cidr5 = new InetCidr(InetAddress.getByName("10.11.13.0"), 24);
    InetCidr cidr6 = new InetCidr(InetAddress.getByName("11.11.12.0"), 24);
    InetCidr cidr7 = new InetCidr(InetAddress.getByName("129.11.12.0"), 24);
    List<InetCidr> list = new ArrayList<InetCidr>();
    list.add(cidr1);
    list.add(cidr5);
    list.add(cidr6);
    list.add(cidr7);
    InetCidr.checkNoOverlap(list);
    list.clear();
    list.add(cidr1);
    list.add(cidr2);
    list.add(cidr3);
    try {
      InetCidr.checkNoOverlap(list);
      Assert.fail();
    } catch (IllegalStateException e) {
      // good
    }
    list.clear();
    list.add(new InetCidr(InetAddress.getByName("10.11.0.0"), 16));
    list.add(cidr1);
    try {
      InetCidr.checkNoOverlap(list);
      Assert.fail();
    } catch (IllegalStateException e) {
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.