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?revision=1970-01-01)name'. "
25 + "Node name collision: '(foo?revision=1970-01-01)name' already declared"));
30 public void testNotification() throws Exception {
32 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-notification.yang");
33 fail("Test should fail due to invalid yang model.");
34 } catch (final SomeModifiersUnresolvedException e) {
35 assertTrue(e.getCause().getMessage().startsWith(
36 "Error in module 'foo': cannot add '(foo?revision=1970-01-01)name'. "
37 + "Node name collision: '(foo?revision=1970-01-01)name' already declared"));
42 public void testData() throws Exception {
44 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-data.yang");
45 fail("Test should fail due to invalid yang model.");
46 } catch (final SomeModifiersUnresolvedException e) {
47 assertTrue(e.getCause().getMessage().startsWith(
48 "Error in module 'foo': cannot add '(foo?revision=1970-01-01)name'. "
49 + "Node name collision: '(foo?revision=1970-01-01)name' already declared"));
54 public void testRpcUses() throws Exception {
56 StmtTestUtils.parseYangSource("/bugs/bug7424/foo-rpc-uses.yang");
57 fail("Test should fail due to invalid yang model.");
58 } catch (final SomeModifiersUnresolvedException e) {
59 assertTrue(e.getCause().getMessage().startsWith(
60 "Error in module 'foo': cannot add '(foo?revision=1970-01-01)name'. "
61 + "Node name collision: '(foo?revision=1970-01-01)name' already declared"));