2 * Copyright (c) 2016 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
8 package org.opendaylight.yangtools.yang.stmt;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
12 import java.util.Optional;
13 import org.junit.jupiter.api.Test;
15 class TypedefSubStmtsTest extends AbstractYangTest {
17 void typedefSubStmtsTest() {
18 final var result = assertEffectiveModel("/typedef-substmts-test/typedef-substmts-test.yang");
20 final var typedefs = result.getTypeDefinitions();
21 assertEquals(1, typedefs.size());
23 final var typedef = typedefs.iterator().next();
24 assertEquals("time-of-the-day", typedef.getQName().getLocalName());
25 assertEquals("string", typedef.getBaseType().getQName().getLocalName());
26 assertEquals(Optional.of("24-hour-clock"), typedef.getUnits());
27 assertEquals("1am", typedef.getDefaultValue().map(Object::toString).orElseThrow());