b1c264c6c3dbd257946d2f4ad1215161286a6e43
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / yangtools / sal / binding / generator / impl / Bug4145Test.java
1 package org.opendaylight.yangtools.sal.binding.generator.impl;
2
3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertTrue;
5 import java.io.IOException;
6 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
7 import java.net.URISyntaxException;
8 import java.io.File;
9 import java.util.List;
10 import org.opendaylight.yangtools.sal.binding.model.api.Type;
11 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
12 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
13 import org.junit.Test;
14
15 public class Bug4145Test {
16     @Test
17     public void bug4145Test() throws URISyntaxException, IOException, YangSyntaxErrorException {
18         File resourceFile = new File(getClass().getResource(
19                 "/bug-4145/foo.yang").toURI());
20         File resourceDir = resourceFile.getParentFile();
21
22         YangParserImpl parser = YangParserImpl.getInstance();
23         SchemaContext context = parser.parseFile(resourceFile, resourceDir);
24
25         List<Type> generateTypes = new BindingGeneratorImpl(false)
26                 .generateTypes(context);
27         assertNotNull(generateTypes);
28         assertTrue(generateTypes.size() > 0);
29     }
30 }