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.yin;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
13 import java.util.Collection;
14 import java.util.Iterator;
15 import java.util.Optional;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
20 public class YinFileTypeDefStmtTest extends AbstractYinModulesTest {
22 public void testTypedef() {
23 Module testModule = context.findModules("config").iterator().next();
24 assertNotNull(testModule);
26 Collection<? extends TypeDefinition<?>> typeDefs = testModule.getTypeDefinitions();
27 assertEquals(1, typeDefs.size());
29 Iterator<? extends TypeDefinition<?>> typeDefIterator = typeDefs.iterator();
30 TypeDefinition<?> typeDef = typeDefIterator.next();
31 assertEquals("service-type-ref", typeDef.getQName().getLocalName());
32 assertEquals(Optional.of("Internal type of references to service type identity."), typeDef.getDescription());
33 assertEquals("identityref", typeDef.getBaseType().getQName().getLocalName());