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.hamcrest.CoreMatchers.containsString;
11 import static org.junit.jupiter.api.Assertions.assertEquals;
13 import org.junit.jupiter.api.Test;
15 class Bug6410Test extends AbstractYangTest {
17 void testTypedefsInRpc() {
18 final var schemaContext = assertEffectiveModel("/bugs/bug6410/foo.yang");
20 final var modules = schemaContext.getModules();
21 assertEquals(1, modules.size());
22 final var module = modules.iterator().next();
24 final var rpcs = module.getRpcs();
25 assertEquals(1, rpcs.size());
26 final var rpc = rpcs.iterator().next();
28 final var typeDefs = rpc.getTypeDefinitions();
29 assertEquals(2, typeDefs.size());
33 void shouldFailOnDuplicateTypedefs() {
34 assertSourceException(containsString("Duplicate name for typedef"), "/bugs/bug6410/bar.yang");