2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.yang.types.rev130715;
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12 import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.IetfYangUtil.INSTANCE;
14 import java.util.UUID;
15 import org.junit.Test;
17 public class IetfYangUtilTest {
19 public void testDottedQuad() {
20 assertArrayEquals(new byte[] { 1, 2, 3, 4 }, INSTANCE.dottedQuadBytes(new DottedQuad("1.2.3.4")));
21 assertEquals(new DottedQuad("1.2.3.4"), INSTANCE.dottedQuadFor(new byte[] { 1, 2, 3, 4 }));
25 public void testHexString() {
26 assertArrayEquals(new byte[] { 0, 1 }, INSTANCE.hexStringBytes(new HexString("00:01")));
27 assertEquals(new HexString("00:01"), INSTANCE.hexStringFor(new byte[] { 0, 1 }));
31 public void testPhysAddress() {
32 assertArrayEquals(new byte[] { 0, 1} , INSTANCE.physAddressBytes(new PhysAddress("00:01")));
33 assertEquals(new PhysAddress("00:01"), INSTANCE.physAddressFor(new byte[] { 0, 1 }));
37 public void testMacAddress() {
38 assertArrayEquals(new byte[] { 0, 1, 2, 3, 4, 5 },
39 INSTANCE.macAddressBytes(new MacAddress("00:01:02:03:04:05")));
40 assertEquals(new MacAddress("00:01:02:03:04:05"), INSTANCE.macAddressFor(new byte[] { 0, 1, 2, 3, 4, 5 }));
44 public void testUuid() {
45 final UUID java = UUID.randomUUID();
46 assertEquals(new Uuid(java.toString()), INSTANCE.uuidFor(java));