2 * Copyright (c) 2017 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.Assert.assertTrue;
11 import static org.junit.Assert.fail;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
16 public class Bug7424Test {
18 public void testRpc() throws Exception {
20 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-rpc.yang");
21 fail("Test should fail due to invalid yang model.");
22 } catch (final SomeModifiersUnresolvedException e) {
23 assertTrue(e.getCause().getMessage().startsWith(
24 "Error in module 'foo': cannot add '(foo)name'. Node name collision: '(foo)name' already declared"));
29 public void testNotification() throws Exception {
31 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-notification.yang");
32 fail("Test should fail due to invalid yang model.");
33 } catch (final SomeModifiersUnresolvedException e) {
34 assertTrue(e.getCause().getMessage().startsWith(
35 "Error in module 'foo': cannot add '(foo)name'. Node name collision: '(foo)name' already declared"));
40 public void testData() throws Exception {
42 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-data.yang");
43 fail("Test should fail due to invalid yang model.");
44 } catch (final SomeModifiersUnresolvedException e) {
45 assertTrue(e.getCause().getMessage().startsWith(
46 "Error in module 'foo': cannot add '(foo)name'. Node name collision: '(foo)name' already declared"));
51 public void testRpcUses() throws Exception {
53 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-rpc-uses.yang");
54 fail("Test should fail due to invalid yang model.");
55 } catch (final SomeModifiersUnresolvedException e) {
56 assertTrue(e.getCause().getMessage().startsWith(
57 "Error in module 'foo': cannot add '(foo)name'. Node name collision: '(foo)name' already declared"));