Revert Merge "Bug 2366: new parser - Types & TypeDefs"
[yangtools.git] / model / ietf / ietf-inet-types / src / test / java / org / opendaylight / yang / gen / v1 / urn / ietf / params / xml / ns / yang / ietf / inet / types / rev100924 / HostBuilderTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924;
10
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Test;
14
15 public class HostBuilderTest {
16
17     @Test
18     public void testGetDefaultInstanceIpv4() throws Exception {
19         Host host = HostBuilder.getDefaultInstance("127.0.0.1");
20         assertEquals(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))), host);
21     }
22
23     @Test
24     public void testGetDefaultInstanceIpv6() throws Exception {
25         testIpv6("2001:db8:8s5a3:0:0:8a2e:370:7334");
26         testIpv6("2001:db8:85a3::8a2e:370:7334");
27     }
28
29     private void testIpv6(final String ivp6string) {
30         Host host = HostBuilder.getDefaultInstance(ivp6string);
31         assertEquals(new Host(new IpAddress(new Ipv6Address(ivp6string))), host);
32     }
33
34     @Test
35     public void testGetDefaultInstanceDomain() throws Exception {
36         Host host = HostBuilder.getDefaultInstance("localhost");
37         assertEquals(new Host(new DomainName("localhost")), host);
38     }
39 }