Simplify BinaryTypeTest 22/95622/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 31 Mar 2021 12:04:28 +0000 (14:04 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 31 Mar 2021 12:04:28 +0000 (14:04 +0200)
We have a very simple utility method to achieve the same thing the test
is doing for models. Simplify it by using a common method.

Change-Id: Ib2311f0f9998f2f42a0b196b5b37fd63be46f048
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BinaryTypeTest.java

index 94f660693837a7f0e65740dfd4e50f223c2a875c..20ab9f1eab068785d6cc6c5460efbb03d070ded6 100644 (file)
@@ -9,35 +9,16 @@ package org.opendaylight.mdsal.binding.generator.impl;
 
 import static org.junit.Assert.assertEquals;
 
-import java.io.File;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
 import java.util.List;
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class BinaryTypeTest {
-    private static final List<File> YANG_MODELS = new ArrayList<>();
-    private static final URL YANG_MODELS_FOLDER = AugmentedTypeTest.class.getResource("/binary-type-test-models");
-
-    @BeforeClass
-    public static void loadTestResources() throws URISyntaxException {
-        final File augFolder = new File(YANG_MODELS_FOLDER.toURI());
-        for (final File fileEntry : augFolder.listFiles()) {
-            if (fileEntry.isFile()) {
-                YANG_MODELS.add(fileEntry);
-            }
-        }
-    }
-
     @Test
     public void binaryTypeTest() {
         final List<GeneratedType> genTypes = DefaultBindingGenerator.generateFor(
-            YangParserTestUtils.parseYangFiles(YANG_MODELS));
-
+            YangParserTestUtils.parseYangResourceDirectory("/binary-type-test-models"));
         assertEquals(9, genTypes.size());
     }
 }