blob: 3cb054ad46cd207d79ef86ff560e67369c34a32f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package io.fd.honeycomb.v3po.translate.v3po.utils;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
public class V3poUtilsTest {
@Test
public void testRemoveIpv4AddressNoZoneFromIpv4WithZone() throws Exception {
String ipWithZone = "1.2.3.4%20";
String ipNoZone = "1.2.3.4";
final Ipv4Address expectedIp = new Ipv4Address(ipNoZone);
final Ipv4AddressNoZone actualIp = V3poUtils.removeIpv4AddressNoZone(new Ipv4Address(ipWithZone));
assertEquals(expectedIp.getValue(), actualIp.getValue());
}
@Test
public void testRemoveIpv4AddressNoZoneFromIpv4WithoutZone() throws Exception {
String ipNoZone = "1.2.3.4";
final Ipv4Address expectedIp = new Ipv4Address(ipNoZone);
final Ipv4AddressNoZone actualIp = V3poUtils.removeIpv4AddressNoZone(expectedIp);
assertEquals(expectedIp.getValue(), actualIp.getValue());
}
@Test
public void testRemoveIpv4AddressNoZoneNop() throws Exception {
String ipNoZone = "1.2.3.4";
final Ipv4Address expectedIp = new Ipv4AddressNoZone(ipNoZone);
final Ipv4AddressNoZone actualIp = V3poUtils.removeIpv4AddressNoZone(expectedIp);
assertEquals(expectedIp, actualIp);
}
}
|