2 * Copyright (c) 2018 Pantheon Technologies, 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.mdsal.binding.generator.impl;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
14 import java.util.List;
15 import org.junit.Test;
16 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
17 import org.opendaylight.mdsal.binding.model.api.Type;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
21 public class Mdsal335Test {
23 public void mdsal335Test() {
24 final SchemaContext context = YangParserTestUtils.parseYangResource("/mdsal335.yang");
26 final List<Type> generateTypes = DefaultBindingGenerator.generateFor(context);
27 assertNotNull(generateTypes);
28 assertEquals(2, generateTypes.size());
30 final Type nozoneType = generateTypes.stream().filter(type -> type.getFullyQualifiedName()
31 .equals("org.opendaylight.yang.gen.v1.mdsal335.norev.Ipv4AddressNoZone")).findFirst().get();
33 assertTrue(nozoneType instanceof GeneratedType);
34 final GeneratedType gen = (GeneratedType) nozoneType;
35 assertEquals(1, gen.getConstantDefinitions().size());