2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertThrows;
13 import org.junit.Test;
15 public class IpPrefixBuilderTest {
17 public void testGetDefaultInstance() throws Exception {
19 testIpv4("192.0.2.1/24");
23 public void testIllegalArgumentException1() {
24 assertThrows(IllegalArgumentException.class, () -> IetfInetUtil.ipPrefixFor("badIp"));
27 private static void testIpv4(final String ip) {
28 assertEquals(new IpPrefix(new Ipv4Prefix(ip)), IetfInetUtil.ipPrefixFor(ip));
31 private static void testIpv6(final String ip) {
32 assertEquals(new IpPrefix(new Ipv6Prefix(ip)), IetfInetUtil.ipPrefixFor(ip));