Replace calls of StmtTestUtils.parseYangSource(String)
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / NameCollisionWithinCaseTest.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.stmt;
9
10 import static org.hamcrest.CoreMatchers.startsWith;
11
12 import org.junit.Test;
13
14 public class NameCollisionWithinCaseTest extends AbstractYangTest {
15     @Test
16     public void testChildNameCollisionOfAugmentCase() {
17         assertSourceException(startsWith("Cannot add data tree child with name (foo?revision=2018-02-11)bar, "
18                 + "a conflicting child already exists [at "), "/bugs/name-collision-within-case/foo.yang");
19     }
20
21     @Test
22     public void testChildNameCollisionOfAugmentChoice() {
23         assertSourceException(startsWith("Cannot add data tree child with name (bar?revision=2018-02-11)bar, "
24                 + "a conflicting child already exists [at "), "/bugs/name-collision-within-case/bar.yang");
25     }
26
27     @Test
28     public void testChildNameCollisionNormal() {
29         assertSourceException(startsWith("Error in module 'baz': cannot add '(baz?revision=2018-02-28)bar'."
30                 + " Node name collision: "), "/bugs/name-collision-within-case/baz.yang");
31     }
32 }