2 * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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.assertEquals;
12 import java.util.List;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceEffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ContainerEffectiveStatement;
19 public class YT1431Test {
21 public void testUnsupportedChoiceLeaf() throws Exception {
22 final var module = StmtTestUtils.parseYangSource("/bugs/YT1431/foo.yang", Set.of())
23 .findModuleStatement(QName.create("foo", "foo"))
25 final var choice = module.findFirstEffectiveSubstatement(ChoiceEffectiveStatement.class).orElseThrow();
26 assertEquals(List.of(), choice.effectiveSubstatements());
30 public void testUnsupportedChoiceLeafAugment() throws Exception {
31 final var module = StmtTestUtils.parseYangSource("/bugs/YT1431/bar.yang", Set.of())
32 .findModuleStatement(QName.create("bar", "bar"))
34 final var choice = module.findFirstEffectiveSubstatement(ContainerEffectiveStatement.class).orElseThrow()
35 .findFirstEffectiveSubstatement(ChoiceEffectiveStatement.class)
37 assertEquals(List.of(), choice.effectiveSubstatements());