@Test
public void testConvertTcpIpPermissionToRuleAndBack() {
IpPermission expected = new IpPermission().withFromPort(1).withToPort(1024)
.withIpProtocol("tcp").withIpRanges("0.0.0.0/0");
Rule rule = ConvertIpPermissionToRule.FUNCTION.apply(expected);
assertNotNull(rule);
assertThat(rule.getCidr()).isEqualTo("0.0.0.0/0");
assertThat(rule.getProtocol()).isEqualTo(Protocol.TCP);
assertThat(rule.getPorts().lowerEndpoint()).isEqualTo(1);
assertThat(rule.getPorts().upperEndpoint()).isEqualTo(1024);
IpPermission actual = ConvertRuleToIpPermission.FUNCTION.apply(rule);
assertThat(actual).isEqualTo(expected);
}