Introduce yangtools.binding.meta
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug2872Test.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
12
13 import java.util.List;
14 import org.junit.jupiter.api.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
18 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
19
20 class Bug2872Test extends AbstractYangTest {
21     @Test
22     void test() {
23         final var schema = assertEffectiveModelDir("/bugs/bug2872");
24         final var myLeaf = assertInstanceOf(LeafSchemaNode.class, schema.getDataChildByName(
25             QName.create("bug2872", "2016-06-08", "bar")));
26         final var myEnum = assertInstanceOf(EnumTypeDefinition.class, myLeaf.getType());
27
28         assertEquals(List.of("value-one", "value-two"), myEnum.getValues().stream().map(EnumPair::getName).toList());
29     }
30 }