Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,12 @@ private InetAddress parseAddress(String address) {
}
}

public InetAddress getRequiredAddress() {
return this.requiredAddress;
}

public int getMaskBits() {
return this.nMaskBits;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,18 @@ public void constructorWhenRequiredAddressIsEmptyThenThrowsIllegalArgumentExcept
assertThatIllegalArgumentException().isThrownBy(() -> new IpAddressMatcher(""))
.withMessage("ipAddress cannot be empty");
}
// gh-16693
@Test
public void getRequiredAddressWhenCidrIsValidThenReturnsHostAddress() {
IpAddressMatcher ipAddressMatcher = new IpAddressMatcher("192.168.1.0/24");
assertThat(ipAddressMatcher.getRequiredAddress().getHostAddress()).isEqualTo("192.168.1.0");
}

// gh-16693
@Test
public void getRequiredAddressWhenCidrIsValidThenReturnsMaskBits() {
IpAddressMatcher ipAddressMatcher = new IpAddressMatcher("192.168.1.0/24");
assertThat(ipAddressMatcher.getMaskBits()).isEqualTo(24);
}

}