2 * Copyright (c) 2014 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
9 package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
15 public class HostBuilderTest {
18 public void testGetDefaultInstanceIpv4() throws Exception {
19 final Host host = HostBuilder.getDefaultInstance("127.0.0.1");
20 assertEquals(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))), host);
24 public void testGetDefaultInstanceIpv6() throws Exception {
25 testIpv6("1234:5678:9abc:def1:2345:6789:abcd:ef12");
28 private static void testIpv6(final String ivp6string) {
29 final Host host = HostBuilder.getDefaultInstance(ivp6string);
30 assertEquals(new Host(new IpAddress(new Ipv6Address(ivp6string))), host);
34 public void testGetDefaultInstanceDomain() throws Exception {
35 final Host host = HostBuilder.getDefaultInstance("localhost");
36 assertEquals(new Host(new DomainName("localhost")), host);