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 junit.framework.Assert;
12 import org.junit.Test;
14 public class HostBuilderTest {
17 public void testGetDefaultInstanceIpv4() throws Exception {
18 Host host = HostBuilder.getDefaultInstance("127.0.0.1");
19 Assert.assertEquals(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))), host);
23 public void testGetDefaultInstanceIpv6() throws Exception {
24 testIpv6("2001:db8:8s5a3:0:0:8a2e:370:7334");
25 testIpv6("2001:db8:85a3::8a2e:370:7334");
28 private void testIpv6(String ivp6string) {
29 Host host = HostBuilder.getDefaultInstance(ivp6string);
30 Assert.assertEquals(new Host(new IpAddress(new Ipv6Address(ivp6string))), host);
34 public void testGetDefaultInstanceDomain() throws Exception {
35 Host host = HostBuilder.getDefaultInstance("localhost");
36 Assert.assertEquals(new Host(new DomainName("localhost")), host);