2 * Copyright (c) 2017 Red Hat, 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.netvirt.qosservice;
10 import static com.google.common.truth.Truth.assertThat;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
16 * Unit test for UuidUtil.
18 * @author Michael Vorburger.ch
20 public class UuidUtilTest {
22 private final UuidUtil uuidUtil = new UuidUtil();
26 assertThat(uuidUtil.newUuidIfValidPattern("f81d4fae-7dec-11d0-a765-00a0c91e6bf6").get())
27 .isEqualTo(new Uuid("f81d4fae-7dec-11d0-a765-00a0c91e6bf6"));
31 public void invalid() {
32 assertThat(uuidUtil.newUuidIfValidPattern("tap61d7aec1-2c"))
33 .isNotEqualTo("tap61d7aec1-11");
38 assertThat(uuidUtil.newUuidIfValidPattern("")).isNotNull();
41 @Test(expected = NullPointerException.class)
42 public void isNull() {
43 assertThat(uuidUtil.newUuidIfValidPattern(null));