ASF Bugzilla – Attachment 27726 Details for
Bug 51953
Proposal: netmask filtering valve and filter [PATCH]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Tests for the NetMask class
TestNetMask.java (text/x-java), 2.25 KB, created by
Francis Galiegue
on 2011-10-07 13:53:05 UTC
(
hide
)
Description:
Tests for the NetMask class
Filename:
MIME Type:
Creator:
Francis Galiegue
Created:
2011-10-07 13:53:05 UTC
Size:
2.25 KB
patch
obsolete
>package org.apache.catalina.util; > >import org.junit.Test; > >import static org.junit.Assert.assertEquals; >import static org.junit.Assert.fail; > >public final class TestNetMask >{ > > @Test > public void testIPV4InitErrors() { > try { > new NetMask("260.1.1.1"); > fail("NetMask succeeded with an invalid address!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "invalid address specification"); > } > > try { > new NetMask("1.2.3.4/foo"); > fail("NetMask succeeded with a non numeric CIDR!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "CIDR is not a number"); > } > > try { > new NetMask("1.2.3.4/-1"); > fail("NetMask succeeded with a negative CIDR!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "CIDR is negative"); > } > > try { > new NetMask("1.2.3.4/33"); > fail("NetMask succeeded with CIDR greater than address length!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "CIDR is greater than address length"); > } > } > > @Test > public void testIPV6InitErrors() { > try { > new NetMask("fffff::/71"); > fail("NetMask succeeded with an invalid address!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "invalid address specification"); > } > > try { > new NetMask("ae31::27:ef2:1/foo"); > fail("NetMask succeeded with a non numeric CIDR!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "CIDR is not a number"); > } > > try { > new NetMask("ae31::27:ef2:1/-1"); > fail("NetMask succeeded with a negative CIDR!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "CIDR is negative"); > } > > try { > new NetMask("ae31::27:ef2:1/129"); > fail("NetMask succeeded with CIDR greater than address length!"); > } catch (IllegalArgumentException e) { > assertEquals(e.getMessage(), "CIDR is greater than address length"); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 51953
:
27686
|
27687
|
27688
|
27689
|
27691
|
27694
|
27726
|
27782