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;
13 import com.google.common.collect.ImmutableList;
14 import com.google.common.collect.ImmutableSet;
15 import java.util.List;
17 import org.junit.Test;
18 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
19 import org.opendaylight.mdsal.binding.model.api.Type;
20 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
23 public class Mdsal332Test {
26 public void mdsal332Test() {
27 final SchemaContext context = YangParserTestUtils.parseYangResource("/mdsal332.yang");
29 final List<Type> generateTypes = new BindingGeneratorImpl().generateTypes(context);
30 assertNotNull(generateTypes);
31 assertEquals(5, generateTypes.size());
33 final List<JavaTypeName> names = generateTypes.stream().map(Type::getIdentifier)
34 .collect(ImmutableList.toImmutableList());
35 final Set<JavaTypeName> uniqueNames = ImmutableSet.copyOf(names);
36 assertEquals(ImmutableList.copyOf(uniqueNames), names);