Migrate binding-codegen to JUnit5 00/114500/7
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 21 Nov 2024 12:00:52 +0000 (13:00 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Nov 2024 09:46:21 +0000 (10:46 +0100)
Migrate away from JUnit4/Hamcrest.

Change-Id: I90a48c4924015abc989bad91d339471771c358e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
32 files changed:
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/AugmentToUsesInAugmentCompilationTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/BaseCompilationTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Bug1276Test.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Bug5151Test.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Bug532Test.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/BuilderGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/ByteRangeGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/CascadeUsesCompilationTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/ClassCodeGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/CompilationTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/CompilationTestUtils.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Decimal64RangeGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/EncodingInJavaDocTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/FileSearchUtil.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/GeneratorJavaFileTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/GeneratorUtilTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/IntegerRangeGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/InterfaceGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/LongRangeGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Mdsal732Test.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Mdsal738Test.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/Mdsal807Test.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/NestedGroupingCompilationTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/PresenceContainerTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/ShortRangeGeneratorTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/SpecializingLeafrefTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/TypeUtilsTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/TypedefCompilationTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/UnionTypedefUnusedImportTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/UnionWithIdentityrefTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/UnionWithMultipleIdentityrefsTest.java
binding/binding-codegen/src/test/java/org/opendaylight/yangtools/binding/codegen/YangModuleInfoCompilationTest.java

index e0996499509c110fa4d2260cb9804a3edf57578d..ad3a9f45917819884a9838fd368c6fc109cbf00e 100644 (file)
@@ -7,16 +7,16 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class AugmentToUsesInAugmentCompilationTest extends BaseCompilationTest {
+class AugmentToUsesInAugmentCompilationTest extends BaseCompilationTest {
     @Test
-    public void testAugmentToUsesInAugment() throws Exception {
+    void testAugmentToUsesInAugment() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("augment-uses-to-augment");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("augment-uses-to-augment");
         generateTestSources("/compilation/augment-uses-to-augment", sourcesOutputDir);
@@ -91,5 +91,4 @@ public class AugmentToUsesInAugmentCompilationTest extends BaseCompilationTest {
 
         CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
     }
-
 }
index 9295ae54b62fd890a986c6929fc1290404052180..76be43d2201f0369c27a3dddb52998163f317ae4 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.yangtools.binding.codegen;
 
 import static java.nio.file.Files.newOutputStream;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import com.google.common.collect.Table;
 import com.google.common.collect.Table.Cell;
@@ -19,9 +19,10 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Optional;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeAll;
 import org.opendaylight.yangtools.binding.contract.Naming;
 import org.opendaylight.yangtools.binding.generator.impl.DefaultBindingGenerator;
 import org.opendaylight.yangtools.binding.model.api.GeneratedType;
@@ -29,10 +30,9 @@ import org.opendaylight.yangtools.plugin.generator.api.GeneratedFile;
 import org.opendaylight.yangtools.plugin.generator.api.GeneratedFilePath;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
-public abstract class BaseCompilationTest {
-
-    @BeforeClass
-    public static void createTestDirs() {
+abstract class BaseCompilationTest {
+    @BeforeAll
+    static final void createTestDirs() {
         if (CompilationTestUtils.TEST_DIR.exists()) {
             CompilationTestUtils.deleteTestDir(CompilationTestUtils.TEST_DIR);
         }
@@ -40,9 +40,9 @@ public abstract class BaseCompilationTest {
         assertTrue(CompilationTestUtils.COMPILER_OUTPUT_DIR.mkdirs());
     }
 
-    protected static final void generateTestSources(final List<GeneratedType> types, final File sourcesOutputDir)
+    static final void generateTestSources(final List<GeneratedType> types, final File sourcesOutputDir)
             throws IOException {
-        types.sort((o1, o2) -> o2.getName().compareTo(o1.getName()));
+        types.sort(Comparator.comparing(GeneratedType::getName).reversed());
 
         final Table<?, GeneratedFilePath, GeneratedFile> generatedFiles = JavaFileGenerator.generateFiles(types, true);
         for (Cell<?, GeneratedFilePath, GeneratedFile> cell : generatedFiles.cellSet()) {
@@ -55,8 +55,7 @@ public abstract class BaseCompilationTest {
         }
     }
 
-    protected static final List<GeneratedType> generateTestSources(final String resourceDirPath,
-            final File sourcesOutputDir) {
+    static final List<GeneratedType> generateTestSources(final String resourceDirPath, final File sourcesOutputDir) {
         final List<File> sourceFiles;
         try {
             sourceFiles = CompilationTestUtils.getSourceFiles(resourceDirPath);
index 2c1dec3f2b0aff22841aff0c329618e9f9b8f1bb..524703f6bfffdccd0fe36cb338b778efe5993c43 100644 (file)
@@ -11,7 +11,7 @@ import java.io.File;
 import java.lang.reflect.Constructor;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test for BG-1276. Previous construction of union constructor
@@ -34,10 +34,9 @@ import org.junit.Test;
  * <p><code>this._value = arg1.getValue()</code> or
  * <code>this._value = _arg1.getValue().toString().toCharArray()</code>
  */
-public class Bug1276Test extends BaseCompilationTest {
-
+class Bug1276Test extends BaseCompilationTest {
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug1276");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug1276");
         generateTestSources("/compilation/bug1276", sourcesOutputDir);
index a0d0bf747ea1d5368938ef5ee3d306320337b2a7..e828f4a7a34398ef3e9b5438d5f7e0496552b09f 100644 (file)
@@ -7,26 +7,25 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.BASE_SVC_PATH;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.FS;
 
 import java.io.File;
 import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Bug5151 involves adding <code>{@literal @}return</code> annotations to accessor methods.
  */
-public class Bug5151Test extends BaseCompilationTest {
-
+class Bug5151Test extends BaseCompilationTest {
     private static final String BUG_ID = "bug5151";
     private static final String SVC_PATH = BASE_SVC_PATH + FS + "urn" + FS + "test" + FS + "foo" + FS + "rev160706";
 
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         // Xtend code generation uses the "line.separator" system property to generate proper line endings
         // in templates, leading to test failures running on Windows-type OS.
         assumeFalse(System.getProperty("os.name").toLowerCase().startsWith("win"));
index 25ce75f5ce32a9f66dacb70ff896779e8056565a..78b2604615b7397e585c03e04705b38ce287b6ac 100644 (file)
@@ -7,28 +7,26 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.BASE_PKG;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.cleanUp;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.testCompilation;
 
-import com.google.common.collect.Lists;
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 /**
  * Test correct functionality of copy constructor of generated builder classes.
  */
-public class Bug532Test extends BaseCompilationTest {
-
+class Bug532Test extends BaseCompilationTest {
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug532");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug532");
         generateTestSources("/compilation/list-gen-test", sourcesOutputDir);
@@ -55,7 +53,7 @@ public class Bug532Test extends BaseCompilationTest {
         Object expectedLevel = Mockito.mock(levelClass);
         Integer expectedLinksId = 11;
         Object expectedNode = Mockito.mock(nodeClass);
-        List<?> expectedNodeList = Lists.newArrayList(Mockito.mock(nodeListClass), Mockito.mock(nodeListClass));
+        List<?> expectedNodeList = List.of(Mockito.mock(nodeListClass), Mockito.mock(nodeListClass));
         Constructor<?> keyConstructor = linksKeyClass.getDeclaredConstructor(Byte.class, String.class, Integer.class);
         Object expectedKey = keyConstructor.newInstance(expectedId, expectedName, expectedSize);
 
index 85444a364d422dede1c7323492d4f9dbad309ce0..50175ed57f8c71806d7cbe90e6511dd53bd68b40 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.doCallRealMethod;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -17,7 +17,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.eclipse.xtend2.lib.StringConcatenation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.generator.impl.DefaultBindingGenerator;
 import org.opendaylight.yangtools.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.binding.model.api.JavaTypeName;
@@ -32,12 +32,12 @@ public class BuilderGeneratorTest {
     private static final JavaTypeName TYPE_NAME = JavaTypeName.create(TEST, TEST);
 
     @Test
-    public void basicTest() {
+    void basicTest() {
         assertEquals("", new BuilderGenerator().generate(mock(Type.class)));
     }
 
     @Test
-    public void builderTemplateGenerateHashcodeWithPropertyTest() {
+    void builderTemplateGenerateHashcodeWithPropertyTest() {
         final GeneratedType genType = mockGenType("get" + TEST);
 
         assertXtendEquals("""
@@ -61,12 +61,12 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateHashCodeWithoutAnyPropertyTest() {
+    void builderTemplateGenerateHashCodeWithoutAnyPropertyTest() {
         assertEquals("", genHashCode(mockGenType(TEST)).toString());
     }
 
     @Test
-    public void builderTemplateGenerateHashCodeWithMorePropertiesTest() {
+    void builderTemplateGenerateHashCodeWithMorePropertiesTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#hashCode()} contract for this interface.
@@ -89,7 +89,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateHashCodeWithoutPropertyWithAugmentTest() {
+    void builderTemplateGenerateHashCodeWithoutPropertyWithAugmentTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#hashCode()} contract for this interface.
@@ -112,7 +112,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateHashCodeWithPropertyWithAugmentTest() {
+    void builderTemplateGenerateHashCodeWithPropertyWithAugmentTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#hashCode()} contract for this interface.
@@ -137,7 +137,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateHashCodeWithMorePropertiesWithAugmentTest() {
+    void builderTemplateGenerateHashCodeWithMorePropertiesWithAugmentTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#hashCode()} contract for this interface.
@@ -163,8 +163,8 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToStringWithPropertyTest() {
-        final GeneratedType genType = mockGenType("get" + TEST);
+    void builderTemplateGenerateToStringWithPropertyTest() {
+        final var genType = mockGenType("get" + TEST);
 
         assertXtendEquals("""
             /**
@@ -186,7 +186,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToStringWithoutAnyPropertyTest() {
+    void builderTemplateGenerateToStringWithoutAnyPropertyTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#toString()} contract for this interface.
@@ -206,7 +206,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToStringWithMorePropertiesTest() {
+    void builderTemplateGenerateToStringWithMorePropertiesTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#toString()} contract for this interface.
@@ -228,7 +228,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToStringWithoutPropertyWithAugmentTest() {
+    void builderTemplateGenerateToStringWithoutPropertyWithAugmentTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#toString()} contract for this interface.
@@ -249,7 +249,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToStringWithPropertyWithAugmentTest() {
+    void builderTemplateGenerateToStringWithPropertyWithAugmentTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#toString()} contract for this interface.
@@ -271,7 +271,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToStringWithMorePropertiesWithAugmentTest() {
+    void builderTemplateGenerateToStringWithMorePropertiesWithAugmentTest() {
         assertXtendEquals("""
             /**
              * Default implementation of {@link Object#toString()} contract for this interface.
@@ -294,7 +294,7 @@ public class BuilderGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateToEqualsComparingOrderTest() {
+    void builderTemplateGenerateToEqualsComparingOrderTest() {
         final var context = YangParserTestUtils.parseYangResource("/test-types.yang");
         final var types = new DefaultBindingGenerator().generateTypes(context);
         assertEquals(27, types.size());
index b083ecba4e67696c98f467b1beaeab2c33af2e8d..495230c6547c4dc1c4cd4052d646c42d303ed4f1 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class ByteRangeGeneratorTest {
+class ByteRangeGeneratorTest {
     @Test
     @Deprecated
-    public void convertTest() {
+    void convertTest() {
         assertTrue(new ByteRangeGenerator().convert(1L).equals(Long.valueOf(1).byteValue()));
     }
 }
index ce4052a4e35406f6d39e23d7e290afcd68f5d247..c2277ea038995cf25ebdf4768685f640ff173b15 100644 (file)
@@ -7,10 +7,10 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.BASE_PKG;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.NS_BAR;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.NS_BAZ;
@@ -28,12 +28,11 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.junit.Test;
-
-public class CascadeUsesCompilationTest extends BaseCompilationTest {
+import org.junit.jupiter.api.Test;
 
+class CascadeUsesCompilationTest extends BaseCompilationTest {
     @Test
-    public void testCascadeUsesCompilation() throws Exception {
+    void testCascadeUsesCompilation() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("cascade-uses");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("cascade-uses");
         generateTestSources("/compilation/cascade-uses", sourcesOutputDir);
@@ -127,5 +126,4 @@ public class CascadeUsesCompilationTest extends BaseCompilationTest {
 
         cleanUp(sourcesOutputDir, compiledOutputDir);
     }
-
 }
index 6898215473e64f7443d3e2e782690d3a8ec5e259..2cb66956915c5aaa815d1efb3392f11669d0b679 100644 (file)
@@ -7,29 +7,26 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.generator.impl.DefaultBindingGenerator;
 import org.opendaylight.yangtools.binding.model.api.GeneratedProperty;
 import org.opendaylight.yangtools.binding.model.api.GeneratedTransferObject;
-import org.opendaylight.yangtools.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.binding.model.api.JavaTypeName;
 import org.opendaylight.yangtools.binding.model.api.type.builder.GeneratedPropertyBuilder;
-import org.opendaylight.yangtools.binding.model.api.type.builder.GeneratedTOBuilder;
 import org.opendaylight.yangtools.binding.model.ri.Types;
 import org.opendaylight.yangtools.binding.model.ri.generated.type.builder.CodegenGeneratedTOBuilder;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
-public class ClassCodeGeneratorTest {
+class ClassCodeGeneratorTest {
     @Test
-    public void compositeKeyClassTest() {
-        final List<GeneratedType> genTypes = new DefaultBindingGenerator().generateTypes(
+    void compositeKeyClassTest() {
+        final var genTypes = new DefaultBindingGenerator().generateTypes(
             YangParserTestUtils.parseYangResource("/list-composite-key.yang"));
 
         assertNotNull(genTypes);
@@ -37,8 +34,8 @@ public class ClassCodeGeneratorTest {
 
         int genTypesCount = 0;
         int genTOsCount = 0;
-        for (final GeneratedType type : genTypes) {
-            if (type instanceof final GeneratedTransferObject genTO) {
+        for (var type : genTypes) {
+            if (type instanceof GeneratedTransferObject genTO) {
                 if (genTO.getName().equals("CompositeKeyListKey")) {
                     final List<GeneratedProperty> properties = genTO
                             .getProperties();
@@ -53,8 +50,8 @@ public class ClassCodeGeneratorTest {
                     final String outputStr = clsGen.generate(genTO);
 
                     assertNotNull(outputStr);
-                    assertThat(outputStr, containsString(
-                        "public CompositeKeyListKey(@NonNull Byte _key1, @NonNull String _key2)"));
+                    assertThat(outputStr)
+                        .contains("public CompositeKeyListKey(@NonNull Byte _key1, @NonNull String _key2)");
 
                     assertEquals(2, propertyCount);
                     genTOsCount++;
@@ -78,9 +75,8 @@ public class ClassCodeGeneratorTest {
      * constructor.
      */
     @Test
-    public void defaultConstructorNotPresentInValueTypeTest() {
-        final GeneratedTOBuilder toBuilder = new CodegenGeneratedTOBuilder(JavaTypeName.create("simple.pack",
-            "DefCtor"));
+    void defaultConstructorNotPresentInValueTypeTest() {
+        final var toBuilder = new CodegenGeneratedTOBuilder(JavaTypeName.create("simple.pack", "DefCtor"));
 
         GeneratedPropertyBuilder propBuilder = toBuilder.addProperty("foo");
         propBuilder.setReturnType(Types.typeForClass(String.class));
@@ -100,9 +96,8 @@ public class ClassCodeGeneratorTest {
     }
 
     @Test
-    public void toStringTest() {
-        final GeneratedTOBuilder toBuilder = new CodegenGeneratedTOBuilder(JavaTypeName.create("simple.pack",
-            "DefCtor"));
+    void toStringTest() {
+        final var toBuilder = new CodegenGeneratedTOBuilder(JavaTypeName.create("simple.pack", "DefCtor"));
 
         GeneratedPropertyBuilder propBuilder = toBuilder.addProperty("foo");
         propBuilder.setReturnType(Types.typeForClass(String.class));
index 0a4c2d639b769b7e07ade6f079c4496aa42dbdce..91ba17400410f93e9f3022f598ca100178d98f79 100644 (file)
@@ -7,15 +7,13 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Range;
 import java.io.File;
@@ -31,7 +29,7 @@ import java.util.Collection;
 import java.util.HexFormat;
 import java.util.List;
 import java.util.stream.Collectors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.ChildOf;
 import org.opendaylight.yangtools.binding.annotations.RoutingContext;
 import org.opendaylight.yangtools.binding.model.ri.TypeConstants;
@@ -46,8 +44,7 @@ import org.opendaylight.yangtools.yang.common.Uint8;
  * Test correct code generation.
  *
  */
-public class CompilationTest extends BaseCompilationTest {
-
+class CompilationTest extends BaseCompilationTest {
     /*
      * Java 8 allows JaCoCo to hook onto interfaces, as well as
      * generating a default implementation. We only want to check
@@ -60,7 +57,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testListGeneration() throws Exception {
+    void testListGeneration() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("list-gen");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("list-gen");
         generateTestSources("/compilation/list-gen", sourcesOutputDir);
@@ -140,7 +137,7 @@ public class CompilationTest extends BaseCompilationTest {
      * @throws Exception when any exception occurs during the test
      */
     @Test
-    public void testContainerGettersGeneration() throws Exception {
+    void testContainerGettersGeneration() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("containers-gen");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("containers-gen");
         generateTestSources("/compilation/containers-gen", sourcesOutputDir);
@@ -187,7 +184,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testAugmentUnderUsesGeneration() {
+    void testAugmentUnderUsesGeneration() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("augment-under-uses");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("augment-under-uses");
         generateTestSources("/compilation/augment-under-uses", sourcesOutputDir);
@@ -295,7 +292,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testAugmentOfAugmentGeneration() {
+    void testAugmentOfAugmentGeneration() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("aug-of-aug");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("aug-of-aug");
         generateTestSources("/compilation/augment-of-augment", sourcesOutputDir);
@@ -428,7 +425,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testLeafReturnTypes() throws Exception {
+    void testLeafReturnTypes() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("leaf-return-types");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("leaf-return-types");
         generateTestSources("/compilation/leaf-return-types", sourcesOutputDir);
@@ -495,7 +492,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testGenerationContextReferenceExtension() throws Exception {
+    void testGenerationContextReferenceExtension() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("context-reference");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("context-reference");
         generateTestSources("/compilation/context-reference", sourcesOutputDir);
@@ -528,7 +525,7 @@ public class CompilationTest extends BaseCompilationTest {
         // test identity
         final Class<?> baseIdentity = Class.forName("org.opendaylight.yangtools.binding.BaseIdentity", true,
             loader);
-        assertEquals(ImmutableList.of(baseIdentity), Arrays.asList(identityClass.getInterfaces()));
+        assertEquals(List.of(baseIdentity), Arrays.asList(identityClass.getInterfaces()));
 
         // Test annotation
         final Method getId;
@@ -544,7 +541,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void compilationTest() {
+    void compilationTest() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("yang");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("yang");
         generateTestSources("/yang", sourcesOutputDir);
@@ -556,7 +553,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testBug586() {
+    void testBug586() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug586");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug586");
         generateTestSources("/compilation/bug586", sourcesOutputDir);
@@ -568,7 +565,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testBug4760() {
+    void testBug4760() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug4760");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug4760");
         generateTestSources("/compilation/bug4760", sourcesOutputDir);
@@ -583,7 +580,7 @@ public class CompilationTest extends BaseCompilationTest {
      * Test handling nested uses-augmentations.
      */
     @Test
-    public void testBug1172() {
+    void testBug1172() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug1172");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug1172");
         generateTestSources("/compilation/bug1172", sourcesOutputDir);
@@ -595,7 +592,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testBug5461() {
+    void testBug5461() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug5461");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug5461");
         generateTestSources("/compilation/bug5461", sourcesOutputDir);
@@ -607,7 +604,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testBug5882() throws Exception {
+    void testBug5882() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug5882");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug5882");
         generateTestSources("/compilation/bug5882", sourcesOutputDir);
@@ -620,7 +617,7 @@ public class CompilationTest extends BaseCompilationTest {
         assertTrue(new File(parent, "TypedefCurrent.java").exists());
         assertTrue(new File(parent, "TypedefDeprecated.java").exists());
 
-        try (URLClassLoader loader = new URLClassLoader(new URL[] { compiledOutputDir.toURI().toURL() })) {
+        try (var loader = new URLClassLoader(new URL[] { compiledOutputDir.toURI().toURL() })) {
             final String pkg = CompilationTestUtils.BASE_PKG + ".urn.yang.foo.rev160102";
             final Class<?> cls = loader.loadClass(pkg + ".FooData");
             final Class<?> clsContainer = loader.loadClass(pkg + ".ContainerMain");
@@ -632,14 +629,14 @@ public class CompilationTest extends BaseCompilationTest {
             final Class<?> clsTypeDef2 = loader.loadClass(pkg + ".Typedef2");
             final Class<?> clsTypeDef3 = loader.loadClass(pkg + ".Typedef3");
             assertEquals(1, clsTypedefDepr.getAnnotations().length);
-            assertThat(clsTypedefDepr.getAnnotations()[0].toString(), startsWith("@java.lang.Deprecated"));
+            assertThat(clsTypedefDepr.getAnnotations()[0].toString()).startsWith("@java.lang.Deprecated");
             assertEquals(0, clsTypedefCur.getAnnotations().length);
             assertEquals(1, clsGroupingDepr.getAnnotations().length);
-            assertThat(clsGroupingDepr.getAnnotations()[0].toString(), startsWith("@java.lang.Deprecated"));
+            assertThat(clsGroupingDepr.getAnnotations()[0].toString()).startsWith("@java.lang.Deprecated");
             assertEquals(0, clsGroupingCur.getAnnotations().length);
             assertEquals(0, clsTypeDef1.getAnnotations().length);
             assertEquals(1, clsTypeDef2.getAnnotations().length);
-            assertThat(clsTypeDef2.getAnnotations()[0].toString(), startsWith("@java.lang.Deprecated"));
+            assertThat(clsTypeDef2.getAnnotations()[0].toString()).startsWith("@java.lang.Deprecated");
             assertEquals(0, clsTypeDef3.getAnnotations().length);
 
             /*methods inside container*/
@@ -667,7 +664,7 @@ public class CompilationTest extends BaseCompilationTest {
      * Test if class generated for node from grouping implements ChildOf.
      */
     @Test
-    public void testBug1377() throws Exception {
+    void testBug1377() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("bug1377");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("bug1377");
 
@@ -691,7 +688,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal327() {
+    void testMdsal327() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal327");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal327");
         generateTestSources("/compilation/mdsal327", sourcesOutputDir);
@@ -700,7 +697,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal365() {
+    void testMdsal365() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal365");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal365");
         generateTestSources("/compilation/mdsal365", sourcesOutputDir);
@@ -709,7 +706,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal395() {
+    void testMdsal395() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal395");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal395");
         generateTestSources("/compilation/mdsal395", sourcesOutputDir);
@@ -718,7 +715,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void classNamesColisionTest() {
+    void classNamesColisionTest() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("class-name-collision");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("class-name-collision");
         generateTestSources("/compilation/class-name-collision", sourcesOutputDir);
@@ -727,7 +724,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void innerEnumerationNameCollisionTest() {
+    void innerEnumerationNameCollisionTest() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal321");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal321");
         generateTestSources("/compilation/mdsal321", sourcesOutputDir);
@@ -736,7 +733,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void twoNestedUnionsTest() {
+    void twoNestedUnionsTest() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal320");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal320");
         generateTestSources("/compilation/mdsal320", sourcesOutputDir);
@@ -745,7 +742,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal425() {
+    void testMdsal425() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal425");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal425");
         generateTestSources("/compilation/mdsal425", sourcesOutputDir);
@@ -754,7 +751,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal426() {
+    void testMdsal426() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal426");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal426");
         generateTestSources("/compilation/mdsal426", sourcesOutputDir);
@@ -763,7 +760,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal529() {
+    void testMdsal529() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal529");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal529");
         generateTestSources("/compilation/mdsal529", sourcesOutputDir);
@@ -772,7 +769,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal589() {
+    void testMdsal589() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal589");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal589");
         generateTestSources("/compilation/mdsal589", sourcesOutputDir);
@@ -781,7 +778,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal533() {
+    void testMdsal533() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal533");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal533");
         generateTestSources("/compilation/mdsal533", sourcesOutputDir);
@@ -790,7 +787,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testMdsal664() {
+    void testMdsal664() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal664");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal664");
         generateTestSources("/compilation/mdsal664", sourcesOutputDir);
@@ -799,7 +796,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testUnionStringPatterns() throws Exception {
+    void testUnionStringPatterns() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("union-string-pattern");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("union-string-pattern");
         generateTestSources("/compilation/union-string-pattern", sourcesOutputDir);
@@ -815,7 +812,7 @@ public class CompilationTest extends BaseCompilationTest {
     }
 
     @Test
-    public void yangDataCompilation() {
+    void yangDataCompilation() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("yang-data-gen");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("yang-data-gen");
 
@@ -865,7 +862,7 @@ public class CompilationTest extends BaseCompilationTest {
             final String className = CompilationTestUtils.BASE_PKG + ".urn.test.yang.data.demo.rev220222." + name;
             // ensure class source is generated
             final String srcPath = className.replace('.', File.separatorChar) + ".java";
-            assertTrue(srcPath + " exists", new File(sourcesOutputDir, srcPath).exists());
+            assertTrue(new File(sourcesOutputDir, srcPath).exists(), srcPath + " exists");
         }
 
         CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
index 1860352fc90600203b79f881ad0b8c4646955413..b505203ad4ed74cd2d984f8565c334680fb1bbe8 100644 (file)
@@ -8,13 +8,12 @@
 package org.opendaylight.yangtools.binding.codegen;
 
 import static com.google.common.base.Preconditions.checkState;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -244,7 +243,7 @@ public final class CompilationTestUtils {
     static void assertContainsRestrictionCheck(final Constructor<?> constructor, final String errorMsg,
             final Object... args) {
         final var cause = assertThrows(InvocationTargetException.class, () -> constructor.newInstance(args)).getCause();
-        assertThat(cause, instanceOf(IllegalArgumentException.class));
+        assertInstanceOf(IllegalArgumentException.class, cause);
         assertEquals(errorMsg, cause.getMessage());
     }
 
@@ -259,7 +258,7 @@ public final class CompilationTestUtils {
     static void assertContainsRestrictionCheck(final Object obj, final Method method, final String errorMsg,
             final Object... args) {
         final var cause = assertThrows(InvocationTargetException.class, () -> method.invoke(obj, args)).getCause();
-        assertThat(cause, instanceOf(IllegalArgumentException.class));
+        assertInstanceOf(IllegalArgumentException.class, cause);
         assertEquals(errorMsg, cause.getMessage());
     }
 
@@ -270,7 +269,7 @@ public final class CompilationTestUtils {
      * @param ifc expected interface
      */
     static void assertImplementsIfc(final Class<?> clazz, final Class<?> ifc) {
-        List<Class<?>> ifcsList = Arrays.asList(clazz.getInterfaces());
+        final var ifcsList = Arrays.asList(clazz.getInterfaces());
         if (!ifcsList.contains(ifc)) {
             throw new AssertionError(clazz + " should implement " + ifc);
         }
@@ -306,7 +305,7 @@ public final class CompilationTestUtils {
         Type[] typeArg = ifcType.getActualTypeArguments();
         assertEquals(1, typeArg.length);
         Type typeArgument = typeArg[0];
-        assertThat(typeArgument, instanceOf(Class.class));
+        assertInstanceOf(Class.class, typeArgument);
         Class<?> argClass = (Class<?>) typeArgument;
         assertEquals(genericTypeName, argClass.getName());
         assertTrue(argClass.isInterface());
@@ -346,7 +345,7 @@ public final class CompilationTestUtils {
             throw new AssertionError("File " + dir + " doesn't exists or it's not a directory");
         }
 
-        assertEquals("Unexpected count of generated files", count, dirContent.length);
+        assertEquals(count, dirContent.length, "Unexpected count of generated files");
     }
 
     /**
index 469d67306ad10a31b907e0b80fde760965fe8614..e0cd58bbb552ba7a1203958c6c2f032bf7b962fc 100644 (file)
@@ -7,16 +7,16 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.math.BigInteger;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.yang.common.Decimal64;
 
-public class Decimal64RangeGeneratorTest {
+class Decimal64RangeGeneratorTest {
     @Test
     @Deprecated
-    public void convertTest() {
+    void convertTest() {
         Decimal64RangeGenerator generator = new Decimal64RangeGenerator();
         Decimal64 one = Decimal64.valueOf(1, 1);
         assertEquals(one, generator.convert(1L));
index a41eebc0cb97473d18a4738dbae3f10ff7ae7081..87bd4fca8488ed7ea812b9ec99830af36d46ab5a 100644 (file)
@@ -11,15 +11,15 @@ import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.cl
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.testCompilation;
 
 import java.io.File;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test if generated classes from yang file is compilable, generated javadoc comments contains
  * symbols as javadoc comment tag, which caused of compilation problem.
  */
-public class EncodingInJavaDocTest extends BaseCompilationTest {
+class EncodingInJavaDocTest extends BaseCompilationTest {
     @Test
-    public void testAugmentToUsesInAugment() {
+    void testAugmentToUsesInAugment() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("encoding-javadoc");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("encoding-javadoc");
         generateTestSources("/compilation/encoding-javadoc", sourcesOutputDir);
index 2f2e68e4b159c9593af43b81e5a7e4bdfdca1745..da59d9d34caf727baa8b4109775fca55f968216c 100644 (file)
@@ -7,8 +7,7 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
 import java.io.IOException;
@@ -31,25 +30,24 @@ final class FileSearchUtil {
     }
 
     static void assertFileContains(final String fileContent, final String searchText) {
-        assertThat(fileContent, containsString(searchText));
+        assertThat(fileContent).contains(searchText);
     }
 
     static void assertFileContainsConsecutiveLines(final File file, final String fileContent, final String ... lines) {
-        for (final String line : lines) {
+        for (var line : lines) {
             assertFileContains(fileContent, line);
         }
         assertFileContains(fileContent, String.join(LS, lines));
     }
 
     static Map<String, File> getFiles(final File path) {
-        final Map<String, File> ret = new HashMap<>();
+        final var ret = new HashMap<String, File>();
         getFiles(path, ret);
         return ret;
     }
 
     private static void getFiles(final File path, final Map<String, File> files) {
-        final File [] dirFiles = path.listFiles();
-        for (File file : dirFiles) {
+        for (var file : path.listFiles()) {
             if (file.isDirectory()) {
                 getFiles(file, files);
             }
index 6fed28e57986b53845ccb57dcf314df0648c3254..bdfe18f0fce4ca8c07bedf475195772ee19eb87a 100644 (file)
@@ -7,26 +7,26 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.binding.model.api.JavaTypeName;
 import org.opendaylight.yangtools.binding.model.api.type.builder.GeneratedTypeBuilder;
 import org.opendaylight.yangtools.binding.model.ri.BindingTypes;
 import org.opendaylight.yangtools.binding.model.ri.generated.type.builder.CodegenGeneratedTypeBuilder;
 
-public class GeneratorJavaFileTest extends BaseCompilationTest {
+class GeneratorJavaFileTest extends BaseCompilationTest {
     private static final String FS = File.separator;
     private static final String PATH = "target/test/test-dir";
 
     @Test
-    public void test() throws IOException {
+    void test() throws IOException {
         final GeneratedTypeBuilder gtb = new CodegenGeneratedTypeBuilder(JavaTypeName.create(
             "org.opendaylight.controller.gen", "Type4"));
         gtb.addImplementsType(BindingTypes.augmentable(gtb));
index 0a18543489ad89382268f23034525e3289e2d2bb..1ae977fcf97249900808171a1a5de020751961c4 100644 (file)
@@ -7,22 +7,24 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.yangtools.binding.codegen.GeneratorUtil.createImports;
 import static org.opendaylight.yangtools.binding.model.ri.TypeConstants.PATTERN_CONSTANT_NAME;
 
-import com.google.common.collect.ImmutableList;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.List;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
 import org.opendaylight.yangtools.binding.model.api.AnnotationType;
 import org.opendaylight.yangtools.binding.model.api.Constant;
 import org.opendaylight.yangtools.binding.model.api.GeneratedProperty;
@@ -33,8 +35,9 @@ import org.opendaylight.yangtools.binding.model.api.MethodSignature;
 import org.opendaylight.yangtools.binding.model.api.ParameterizedType;
 import org.opendaylight.yangtools.binding.model.api.Type;
 
-@RunWith(MockitoJUnitRunner.StrictStubs.class)
-public class GeneratorUtilTest {
+@MockitoSettings(strictness = Strictness.LENIENT)
+@ExtendWith(MockitoExtension.class)
+class GeneratorUtilTest {
     private static final JavaTypeName ANNOTATION = JavaTypeName.create("tst.package", "tstAnnotationName");
     private static final JavaTypeName PARAMETERIZED_TYPE = JavaTypeName.create("tst.package", "tstParametrizedType");
     private static final JavaTypeName TYPE = JavaTypeName.create("tst.package", "tstName");
@@ -60,8 +63,8 @@ public class GeneratorUtilTest {
     @Mock
     private GeneratedTransferObject superType;
 
-    @Before
-    public void before() {
+    @BeforeEach
+    void before() {
         doReturn("tst.package").when(parameterizedType).getPackageName();
         doReturn("tstParametrizedType").when(parameterizedType).getName();
         doReturn(PARAMETERIZED_TYPE).when(parameterizedType).getIdentifier();
@@ -70,12 +73,12 @@ public class GeneratorUtilTest {
         doReturn(TYPE).when(type).getIdentifier();
         doReturn(parameterizedType).when(property).getReturnType();
         doReturn(new Type[] { type }).when(parameterizedType).getActualTypeArguments();
-        doReturn(ImmutableList.of(property)).when(enclosedType).getProperties();
+        doReturn(List.of(property)).when(enclosedType).getProperties();
         doReturn(Boolean.TRUE).when(property).isReadOnly();
         doReturn("tst.package").when(enclosedType).getPackageName();
         doReturn("tstName").when(enclosedType).getName();
 
-        doReturn(ImmutableList.of(parameter)).when(methodSignature).getParameters();
+        doReturn(List.of(parameter)).when(methodSignature).getParameters();
 
         doReturn("tst.package").when(annotationType).getPackageName();
         doReturn("tstAnnotationName").when(annotationType).getName();
@@ -83,61 +86,61 @@ public class GeneratorUtilTest {
 
         doReturn(type).when(parameter).getType();
         doReturn(type).when(methodSignature).getReturnType();
-        doReturn(ImmutableList.of(annotationType)).when(methodSignature).getAnnotations();
-        doReturn(ImmutableList.of(methodSignature)).when(enclosedType).getMethodDefinitions();
+        doReturn(List.of(annotationType)).when(methodSignature).getAnnotations();
+        doReturn(List.of(methodSignature)).when(enclosedType).getMethodDefinitions();
 
         doReturn(PATTERN_CONSTANT_NAME).when(constant).getName();
-        doReturn(ImmutableList.of(constant)).when(enclosedType).getConstantDefinitions();
+        doReturn(List.of(constant)).when(enclosedType).getConstantDefinitions();
 
-        doReturn(ImmutableList.of()).when(enclosedType).getEnclosedTypes();
-        doReturn(ImmutableList.of(enclosedType)).when(generatedType).getEnclosedTypes();
+        doReturn(List.of()).when(enclosedType).getEnclosedTypes();
+        doReturn(List.of(enclosedType)).when(generatedType).getEnclosedTypes();
     }
 
     @Test
-    public void createChildImportsTest() {
+    void createChildImportsTest() {
         doReturn("tst.package").when(enclosedType).getPackageName();
         doReturn("tstName").when(enclosedType).getName();
-        doReturn(ImmutableList.of()).when(enclosedType).getEnclosedTypes();
-        doReturn(ImmutableList.of(enclosedType)).when(generatedType).getEnclosedTypes();
+        doReturn(List.of()).when(enclosedType).getEnclosedTypes();
+        doReturn(List.of(enclosedType)).when(generatedType).getEnclosedTypes();
         final var generated = GeneratorUtil.createChildImports(generatedType);
         assertNotNull(generated);
         assertTrue(generated.get("tstName").equals("tst.package"));
     }
 
     @Test
-    public void createImportsWithExceptionTest() {
+    void createImportsWithExceptionTest() {
         final var iae = assertThrows(IllegalArgumentException.class, () -> GeneratorUtil.createImports(null));
         assertEquals("Generated Type cannot be NULL!", iae.getMessage());
     }
 
     @Test
-    public void createImportsTest() {
+    void createImportsTest() {
         final var generated = createImports(generatedType);
         assertNotNull(generated);
         assertEquals(JavaTypeName.create("tst.package", "tstAnnotationName"), generated.get("tstAnnotationName"));
     }
 
     @Test
-    public void isConstantToExceptionTest() {
+    void isConstantToExceptionTest() {
         final var iae = assertThrows(IllegalArgumentException.class, () -> GeneratorUtil.isConstantInTO(null, null));
         assertNull(iae.getMessage());
     }
 
     @Test
-    public void isConstantToTest() {
+    void isConstantToTest() {
         doReturn("tst2").when(constant).getName();
-        doReturn(ImmutableList.of(constant)).when(enclosedType).getConstantDefinitions();
+        doReturn(List.of(constant)).when(enclosedType).getConstantDefinitions();
         assertFalse(GeneratorUtil.isConstantInTO("tst", enclosedType));
     }
 
     @Test
-    public void getPropertiesOfAllParentsTest() {
+    void getPropertiesOfAllParentsTest() {
         doReturn(enclosedType).when(superType).getSuperType();
         assertTrue(GeneratorUtil.getPropertiesOfAllParents(superType).contains(property));
     }
 
     @Test
-    public void getExplicitTypeTest() {
+    void getExplicitTypeTest() {
         assertEquals(annotationType.getName(), GeneratorUtil.getExplicitType(
                 generatedType, annotationType, createImports(generatedType)));
 
index 822d7e0523709fdb0f5e30171a124ed752b51fa3..73fce10b4dbd7b8346946ae65e104e9c11d46ceb 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class IntegerRangeGeneratorTest {
+class IntegerRangeGeneratorTest {
     @Test
     @Deprecated
-    public void convertTest() {
+    void convertTest() {
         assertTrue(new IntegerRangeGenerator().convert(1L).equals(Long.valueOf(1).intValue()));
     }
 }
index 2082686c5a70ab37342cbdd0aedb7a44a9111e44..27a84f1abf0d76312b0793fca882e76c03dd8162 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 
-import com.google.common.collect.ImmutableList;
 import java.util.ArrayList;
 import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.model.api.AnnotationType;
 import org.opendaylight.yangtools.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.binding.model.api.JavaTypeName;
@@ -23,17 +22,17 @@ import org.opendaylight.yangtools.binding.model.api.MethodSignature;
 import org.opendaylight.yangtools.binding.model.api.Type;
 import org.opendaylight.yangtools.binding.model.ri.Types;
 
-public class InterfaceGeneratorTest {
+class InterfaceGeneratorTest {
     private static final String TEST = "test";
     private static final JavaTypeName TYPE_NAME = JavaTypeName.create(TEST, TEST);
 
     @Test
-    public void basicTest() {
+    void basicTest() {
         assertEquals("", new InterfaceGenerator().generate(mock(Type.class)));
     }
 
     @Test
-    public void builderTemplateListenerMethodTest() {
+    void builderTemplateListenerMethodTest() {
         final MethodSignature methSign = mockMethSign("on" + TEST);
         final GeneratedType genType = mockGenType(methSign);
 
@@ -58,7 +57,7 @@ public class InterfaceGeneratorTest {
     }
 
     @Test
-    public void builderTemplateDeprecatedListenerMethodTest() {
+    void builderTemplateDeprecatedListenerMethodTest() {
         final MethodSignature methSign = mockMethSign("on" + TEST);
         addMethodStatus(methSign, JavaTypeName.create(Deprecated.class));
         final GeneratedType genType = mockGenType(methSign);
@@ -86,7 +85,7 @@ public class InterfaceGeneratorTest {
     }
 
     @Test
-    public void builderTemplateGenerateObsoleteListenerMethodTest() {
+    void builderTemplateGenerateObsoleteListenerMethodTest() {
         final MethodSignature methSign = mockMethSign("on" + TEST);
         addMethodStatus(methSign, JavaTypeName.create(Deprecated.class));
         doReturn(true).when(methSign).isDefault();
@@ -142,6 +141,6 @@ public class InterfaceGeneratorTest {
     private static void addMethodStatus(final MethodSignature methSign, final JavaTypeName annotationJavaType) {
         final AnnotationType annotationType = mock(AnnotationType.class);
         doReturn(annotationJavaType).when(annotationType).getIdentifier();
-        doReturn(ImmutableList.of(annotationType)).when(methSign).getAnnotations();
+        doReturn(List.of(annotationType)).when(methSign).getAnnotations();
     }
 }
index 3027805457763a9562664e7ff52e321180f55101..2073a02d4cfbfa384803e77a2e9ca656759b7fb1 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class LongRangeGeneratorTest {
+class LongRangeGeneratorTest {
     @Test
     @Deprecated
-    public void convertTest() {
+    void convertTest() {
         assertTrue(new LongRangeGenerator().convert(1).equals(Integer.valueOf(1).longValue()));
     }
 }
index 9fde6e344433c413e98e5dd1ea4f2543d4ac77cb..99987bdcb5a9ad9b3083d6f6a796c37f9e704faa 100644 (file)
@@ -7,31 +7,31 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.io.File;
 import java.nio.file.Files;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class Mdsal732Test extends BaseCompilationTest {
+class Mdsal732Test extends BaseCompilationTest {
     private File sourcesOutputDir;
     private File compiledOutputDir;
 
-    @Before
-    public void before() {
+    @BeforeEach
+    void before() {
         sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal732");
         compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal732");
     }
 
-    @After
-    public void after() {
+    @AfterEach
+    void after() {
         CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
     }
 
     @Test
-    public void testIdentityrefLeafrefSpecialization() throws Exception {
+    void testIdentityrefLeafrefSpecialization() throws Exception {
         generateTestSources("/compilation/mdsal732", sourcesOutputDir);
         final var xyzzyBuilder = FileSearchUtil.getFiles(sourcesOutputDir).get("XyzzyBuilder.java");
         assertNotNull(xyzzyBuilder);
index 792c53b54266bceb76427aa6b15f0afd4aec8218..0fb7c4db50d12c61e093c0a5b5aac0b5b2072437 100644 (file)
@@ -7,31 +7,31 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.io.File;
 import java.nio.file.Files;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class Mdsal738Test extends BaseCompilationTest {
     private File sourcesOutputDir;
     private File compiledOutputDir;
 
-    @Before
-    public void before() {
+    @BeforeEach
+    void before() {
         sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal738");
         compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal738");
     }
 
-    @After
-    public void after() {
+    @AfterEach
+    void after() {
         CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
     }
 
     @Test
-    public void testUnionOfDecimal64() throws Exception {
+    void testUnionOfDecimal64() throws Exception {
         generateTestSources("/compilation/mdsal738", sourcesOutputDir);
         final var pmDataType = FileSearchUtil.getFiles(sourcesOutputDir).get("PmDataType.java");
         assertNotNull(pmDataType);
index 02c7295549141ac967b0fcc25b810d149b3e3dd7..821209d3ca645460bb52ed1f8bef5adc2b47fb2f 100644 (file)
@@ -7,31 +7,31 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.io.File;
 import java.nio.file.Files;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class Mdsal807Test extends BaseCompilationTest {
+class Mdsal807Test extends BaseCompilationTest {
     private File sourcesOutputDir;
     private File compiledOutputDir;
 
-    @Before
-    public void before() {
+    @BeforeEach
+    void before() {
         sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal807");
         compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal807");
     }
 
-    @After
-    public void after() {
+    @AfterEach
+    void after() {
         CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
     }
 
     @Test
-    public void testBitsTypedef() throws Exception {
+    void testBitsTypedef() throws Exception {
         generateTestSources("/compilation/mdsal807", sourcesOutputDir);
         final var pmDataType = FileSearchUtil.getFiles(sourcesOutputDir).get("TableConfig.java");
         assertNotNull(pmDataType);
index c81781ebf6842a6f334d3edc5b0d68e34a903cae..20361aaa55e5a117233a53fcbe35ed20b38580df 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.BASE_PKG;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.NS_SVC_TEST;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.NS_TEST;
@@ -19,16 +19,15 @@ import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.te
 import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test correct code generation.
  *
  */
-public class NestedGroupingCompilationTest extends BaseCompilationTest {
-
+class NestedGroupingCompilationTest extends BaseCompilationTest {
     @Test
-    public void testListGeneration() throws Exception {
+    void testListGeneration() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("nested-grouping");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("nested-grouping");
         generateTestSources("/compilation/nested-grouping", sourcesOutputDir);
index e0f992ba14bb897e71831bcbe536f235d7c80af6..97e80d002ecf6c2ec33ded42c8ac38e06327de51 100644 (file)
@@ -7,15 +7,15 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.doReturn;
 
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
 import org.opendaylight.yangtools.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.binding.model.api.YangSourceDefinition;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -24,8 +24,8 @@ import org.opendaylight.yangtools.yang.common.XMLNamespace;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
-@RunWith(MockitoJUnitRunner.StrictStubs.class)
-public class PresenceContainerTest {
+@ExtendWith(MockitoExtension.class)
+class PresenceContainerTest {
     private static final QName DIRECTORY_QNAME = QName.create("urn:opendaylight:presence-container",
             "2022-03-17", "directory");
     private static final QName USER_QNAME = QName.create("urn:opendaylight:presence-container",
@@ -40,8 +40,8 @@ public class PresenceContainerTest {
     @Mock
     GeneratedType type;
 
-    @BeforeClass
-    public static void beforeClass() {
+    @BeforeAll
+    static void beforeClass() {
         final var context = YangParserTestUtils.parseYangResource("/presence-container.yang");
         module = context.findModule(XMLNamespace.of("urn:opendaylight:presence-container"), Revision.of("2022-03-17"))
                 .orElseThrow();
@@ -51,7 +51,7 @@ public class PresenceContainerTest {
      * Test that type which is NOT container is NOT recognized as non-presence container.
      */
     @Test
-    public void nonContainerIsNonPresenceContainerTest() {
+    void nonContainerIsNonPresenceContainerTest() {
         final var userList = module.findDataTreeChild(DIRECTORY_QNAME, USER_QNAME).orElseThrow();
         final var definition = YangSourceDefinition.of(module, userList);
         doReturn(definition).when(type).getYangSourceDefinition();
@@ -62,7 +62,7 @@ public class PresenceContainerTest {
      * Test that presence container is NOT recognized as non-presence container.
      */
     @Test
-    public void presenceContainerIsNonPresenceContainerTest() {
+    void presenceContainerIsNonPresenceContainerTest() {
         final var scpContainer = module.findDataTreeChild(DIRECTORY_QNAME, SCP_QNAME).orElseThrow();
         final var definition = YangSourceDefinition.of(module, scpContainer);
         doReturn(definition).when(type).getYangSourceDefinition();
@@ -73,7 +73,7 @@ public class PresenceContainerTest {
      * Test that non-presence container IS recognized as non-presence container.
      */
     @Test
-    public void nonPresenceContainerIsNonPresenceContainerTest() {
+    void nonPresenceContainerIsNonPresenceContainerTest() {
         final var dataContainer = module.findDataTreeChild(DIRECTORY_QNAME, DATA_QNAME).orElseThrow();
         final var definition = YangSourceDefinition.of(module, dataContainer);
         doReturn(definition).when(type).getYangSourceDefinition();
index 735546d4047b187d010cc9a3eaba41788463d7fd..8d0b8b86e35ad35c7b981c860e85a576dacc108e 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class ShortRangeGeneratorTest {
+class ShortRangeGeneratorTest {
     @Test
     @Deprecated
-    public void convertTest() {
+    void convertTest() {
         assertTrue(new ShortRangeGenerator().convert(1L).equals(Long.valueOf(1).shortValue()));
     }
 }
index 22040d3b365590fff19d7eae43af64928221d07f..25def342d6dcf803ece59e366656adbc2c1743cd 100644 (file)
@@ -7,11 +7,9 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.opendaylight.yangtools.binding.codegen.FileSearchUtil.DOUBLE_TAB;
 import static org.opendaylight.yangtools.binding.codegen.FileSearchUtil.TAB;
 import static org.opendaylight.yangtools.binding.codegen.FileSearchUtil.TRIPLE_TAB;
@@ -25,16 +23,16 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.contract.Naming;
 import org.opendaylight.yangtools.binding.model.api.GeneratedType;
 import org.opendaylight.yangtools.binding.model.api.ParameterizedType;
 import org.opendaylight.yangtools.binding.model.api.Type;
 import org.opendaylight.yangtools.binding.model.ri.Types;
 
-public class SpecializingLeafrefTest extends BaseCompilationTest {
+class SpecializingLeafrefTest extends BaseCompilationTest {
     private static final ParameterizedType SET_STRING_TYPE  = Types.setTypeFor(Types.STRING);
 
     public static final String BAR_CONT = "BarCont";
@@ -77,8 +75,8 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
     private List<GeneratedType> types;
     private Map<String, File> files;
 
-    @Before
-    public void before() {
+    @BeforeEach
+    void before() {
         sourcesOutputDir = CompilationTestUtils.generatorOutput("mdsal426");
         compiledOutputDir = CompilationTestUtils.compilerOutput("mdsal426");
         types = generateTestSources("/compilation/mdsal426", sourcesOutputDir);
@@ -86,42 +84,42 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
         files = getFiles(sourcesOutputDir);
     }
 
-    @After
-    public void after() {
+    @AfterEach
+    void after() {
         CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
     }
 
     @Test
-    public void testGroupingWithUnresolvedLeafRefs() throws Exception {
+    void testGroupingWithUnresolvedLeafRefs() throws Exception {
         verifyReturnType(FOO_GRP, GET_LEAF1_NAME, Types.objectType());
         verifyReturnType(FOO_GRP, GET_LEAFLIST1_NAME, Types.setTypeWildcard());
 
         final String content = getFileContent(FOO_GRP);
 
-        assertThat(content, containsString(GET_LEAF1_TYPE_OBJECT));
-        assertThat(content, containsString(GET_LEAFLIST1_WILDCARD));
+        assertThat(content).contains(GET_LEAF1_TYPE_OBJECT);
+        assertThat(content).contains(GET_LEAFLIST1_WILDCARD);
     }
 
     @Test
-    public void testLeafLeafrefPointsLeaf() throws Exception {
+    void testLeafLeafrefPointsLeaf() throws Exception {
         verifyReturnType(RESOLVED_LEAF_GRP, GET_LEAF1_NAME, Types.STRING);
 
         final String content = getFileContent(RESOLVED_LEAF_GRP);
 
-        assertThat(content, containsString(GET_LEAF1_TYPE_STRING));
+        assertThat(content).contains(GET_LEAF1_TYPE_STRING);
     }
 
     @Test
-    public void testLeafLeafrefPointsLeafList() throws Exception {
+    void testLeafLeafrefPointsLeafList() throws Exception {
         verifyReturnType(RESOLVED_LEAFLIST_GRP, GET_LEAF1_NAME, Types.STRING);
 
         final String content = getFileContent(RESOLVED_LEAF_GRP);
 
-        assertThat(content, containsString(GET_LEAF1_TYPE_STRING));
+        assertThat(content).contains(GET_LEAF1_TYPE_STRING);
     }
 
     @Test
-    public void testLeafListLeafrefPointsLeaf() throws Exception {
+    void testLeafListLeafrefPointsLeaf() throws Exception {
         verifyReturnType(RESOLVED_LEAF_GRP, GET_LEAFLIST1_NAME, SET_STRING_TYPE);
 
         final String content = getFileContent(RESOLVED_LEAF_GRP);
@@ -130,7 +128,7 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testLeafListLeafrefPointsLeafList() throws Exception {
+    void testLeafListLeafrefPointsLeafList() throws Exception {
         verifyReturnType(RESOLVED_LEAFLIST_GRP, GET_LEAFLIST1_NAME, SET_STRING_TYPE);
 
         final String content = getFileContent(RESOLVED_LEAFLIST_GRP);
@@ -139,18 +137,18 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
     }
 
     @Test
-    public void testGroupingWhichInheritUnresolvedLeafrefAndDoesNotDefineIt() throws Exception {
+    void testGroupingWhichInheritUnresolvedLeafrefAndDoesNotDefineIt() throws Exception {
         verifyMethodAbsence(TRANSITIVE_GROUP, GET_LEAF1_NAME);
         verifyMethodAbsence(TRANSITIVE_GROUP, GET_LEAFLIST1_NAME);
 
         final String content = getFileContent(TRANSITIVE_GROUP);
 
-        assertThat(content, not(containsString(GET_LEAF1_DECLARATION)));
-        assertThat(content, not(containsString(GET_LEAFLIST1_DECLARATION)));
+        assertThat(content).doesNotContain(GET_LEAF1_DECLARATION);
+        assertThat(content).doesNotContain(GET_LEAFLIST1_DECLARATION);
     }
 
     @Test
-    public void testLeafrefWhichPointsBoolean() throws Exception {
+    void testLeafrefWhichPointsBoolean() throws Exception {
         verifyReturnType(UNRESOLVED_GROUPING, GET_LEAF1_NAME, Types.objectType());
         verifyReturnType(BOOLEAN_CONT, GET_LEAF1_NAME, Types.BOOLEAN);
 
@@ -158,11 +156,11 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
         final String booleanCont = getFileContent(BOOLEAN_CONT);
 
         assertNotOverriddenGetter(unresolvedGrouping, GET_LEAF1_TYPE_OBJECT);
-        assertThat(booleanCont, containsString(GET_LEAF1_DECLARATION));
+        assertThat(booleanCont).contains(GET_LEAF1_DECLARATION);
     }
 
     @Test
-    public void testGroupingsUsageWhereLeafrefAlreadyResolved() throws Exception {
+    void testGroupingsUsageWhereLeafrefAlreadyResolved() throws Exception {
         leafList1AndLeaf1Absence(BAR_CONT);
         leafList1AndLeaf1Absence(BAR_LST);
         leafList1AndLeaf1Absence(BAZ_GRP);
@@ -174,21 +172,21 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
 
         final String content = getFileContent(typeName);
 
-        assertThat(content, not(containsString(GET_LEAF1_DECLARATION)));
-        assertThat(content, not(containsString(GET_LEAFLIST1_DECLARATION)));
+        assertThat(content).doesNotContain(GET_LEAF1_DECLARATION);
+        assertThat(content).doesNotContain(GET_LEAFLIST1_DECLARATION);
     }
 
     private static void assertNotOverriddenGetter(final String fileContent, final String getterString) {
-        assertThat(fileContent, not(containsString("@Override" + System.lineSeparator() + getterString)));
-        assertThat(fileContent, containsString(getterString));
+        assertThat(fileContent).doesNotContain("@Override" + System.lineSeparator() + getterString);
+        assertThat(fileContent).contains(getterString);
     }
 
     private static void assertOverriddenGetter(final String fileContent, final String getterString) {
-        assertThat(fileContent, containsString("@Override" + System.lineSeparator() + getterString));
+        assertThat(fileContent).contains("@Override" + System.lineSeparator() + getterString);
     }
 
     @Test
-    public void barContBuilderDataObjectTest() throws Exception {
+    void barContBuilderDataObjectTest() throws Exception {
         final File file = files.get(getJavaBuilderFileName(BAR_CONT));
         final String content = Files.readString(file.toPath());
 
@@ -239,7 +237,7 @@ public class SpecializingLeafrefTest extends BaseCompilationTest {
     }
 
     @Test
-    public void booleanContBuilderDataObjectTest() throws Exception {
+    void booleanContBuilderDataObjectTest() throws Exception {
         final File file = files.get(getJavaBuilderFileName(BOOLEAN_CONT));
         final String content = Files.readString(file.toPath());
 
index f1928c5f8f60ae0ed243af6a512206431dbd04d9..364593d87450fdfc24c47c54b1a888dad35b8685 100644 (file)
@@ -7,21 +7,21 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
 import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.model.api.ConcreteType;
 import org.opendaylight.yangtools.binding.model.api.GeneratedProperty;
 import org.opendaylight.yangtools.binding.model.api.GeneratedTransferObject;
 import org.opendaylight.yangtools.binding.model.api.Type;
 
-public class TypeUtilsTest {
+class TypeUtilsTest {
     @Test
-    public void getBaseYangTypeTest() {
+    void getBaseYangTypeTest() {
         final GeneratedTransferObject rootType = mock(GeneratedTransferObject.class);
         final GeneratedTransferObject innerType = mock(GeneratedTransferObject.class);
         final GeneratedProperty property = mock(GeneratedProperty.class);
@@ -36,7 +36,7 @@ public class TypeUtilsTest {
     }
 
     @Test
-    public void getBaseYangTypeWithExceptionTest() {
+    void getBaseYangTypeWithExceptionTest() {
         final GeneratedTransferObject rootType = mock(GeneratedTransferObject.class);
         final GeneratedTransferObject innerType = mock(GeneratedTransferObject.class);
         final GeneratedProperty property = mock(GeneratedProperty.class);
index 0e6f7b5407bffbe6530e316bd3df757dc2c96dba..e751b3b9af6239029ad87f3187e65ce7cfe2a3cb 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import com.google.common.collect.Range;
 import java.io.File;
@@ -20,20 +20,20 @@ import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Empty;
 
 /**
  * Test correct code generation.
  */
-public class TypedefCompilationTest extends BaseCompilationTest {
+class TypedefCompilationTest extends BaseCompilationTest {
     private static final String VAL = "_value";
     private static final String GET_VAL = "getValue";
     private static final String UNITS = "_UNITS";
 
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("typedef");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("typedef");
         generateTestSources("/compilation/typedef", sourcesOutputDir);
index d6b89b071034646b413eb1da33d76e941029f8f5..7fc690d4b0bb58c5dda5891f0051c17e2ad9d503 100644 (file)
@@ -7,16 +7,16 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.cleanUp;
 import static org.opendaylight.yangtools.binding.codegen.CompilationTestUtils.testCompilation;
 
 import java.io.File;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class UnionTypedefUnusedImportTest extends BaseCompilationTest {
+class UnionTypedefUnusedImportTest extends BaseCompilationTest {
     @Test
-    public void testUnionTypedefUnusedImport() {
+    void testUnionTypedefUnusedImport() {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("union-typedef");
         final var types = generateTestSources("/compilation/union-typedef", sourcesOutputDir);
         assertEquals(2, types.size());
index 7673a742c654ace6aa83a3bb237f86f0dd773507..560635f6124e9007a6f24da09efcd42d8fb58a4c 100644 (file)
@@ -7,25 +7,24 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.contract.Naming;
 
 /**
  * Union constructor with indentityref. Previously identityref was ignored so that there is no constructor for
  * identityref.
  */
-public class UnionWithIdentityrefTest extends BaseCompilationTest {
-
+class UnionWithIdentityrefTest extends BaseCompilationTest {
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("union-with-identityref");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("union-with-identityref");
         generateTestSources("/compilation/union-with-identityref", sourcesOutputDir);
index c2fc8e34d086a346b7e5a81e7faceb6538dc86ca..aa9d131a433606702d694de110997ba5ca93ad8e 100644 (file)
@@ -7,19 +7,19 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.contract.Naming;
 
-public class UnionWithMultipleIdentityrefsTest extends BaseCompilationTest {
+class UnionWithMultipleIdentityrefsTest extends BaseCompilationTest {
     @Test
-    public void test() throws Exception {
+    void test() throws Exception {
         final File sourcesOutputDir = CompilationTestUtils.generatorOutput("union-with-multiple-identityrefs");
         final File compiledOutputDir = CompilationTestUtils.compilerOutput("union-with-multiple-identityrefs");
         generateTestSources("/compilation/union-with-multiple-identityrefs", sourcesOutputDir);
index e4f533676326243c96c2bfa5beafcf6094fbb55c..dda480aee540e53190de0c5d35c9dbaf03bef876 100644 (file)
@@ -7,30 +7,26 @@
  */
 package org.opendaylight.yangtools.binding.codegen;
 
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Table;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.OutputStream;
 import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.Set;
 import javax.tools.Diagnostic;
@@ -38,8 +34,8 @@ import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.binding.meta.YangModuleInfo;
 import org.opendaylight.yangtools.plugin.generator.api.GeneratedFile;
 import org.opendaylight.yangtools.plugin.generator.api.GeneratedFilePath;
@@ -54,7 +50,7 @@ import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
  */
 // TODO: most of private static methods are copied from
 // binding-java-api-generator project - reorganize compilation tests
-public class YangModuleInfoCompilationTest {
+class YangModuleInfoCompilationTest {
     public static final String FS = File.separator;
     private static final String BASE_PKG = "org.opendaylight.yang.svc.v1";
 
@@ -66,8 +62,8 @@ public class YangModuleInfoCompilationTest {
     private static final String COMPILER_OUTPUT_PATH = TEST_PATH + FS + "bin";
     private static final File COMPILER_OUTPUT_DIR = new File(COMPILER_OUTPUT_PATH);
 
-    @BeforeClass
-    public static void createTestDirs() {
+    @BeforeAll
+    static void createTestDirs() {
         if (TEST_DIR.exists()) {
             deleteTestDir(TEST_DIR);
         }
@@ -76,11 +72,11 @@ public class YangModuleInfoCompilationTest {
     }
 
     @Test
-    public void compilationTest() throws Exception {
+    void compilationTest() throws Exception {
         final File sourcesOutputDir = new File(GENERATOR_OUTPUT_PATH + FS + "yang");
-        assertTrue("Failed to create test file '" + sourcesOutputDir + "'", sourcesOutputDir.mkdirs());
+        assertTrue(sourcesOutputDir.mkdirs(), "Failed to create test file '" + sourcesOutputDir + "'");
         final File compiledOutputDir = new File(COMPILER_OUTPUT_PATH + FS + "yang");
-        assertTrue("Failed to create test file '" + compiledOutputDir + "'", compiledOutputDir.mkdirs());
+        assertTrue(compiledOutputDir.mkdirs(), "Failed to create test file '" + compiledOutputDir + "'");
 
         generateTestSources("/yang-module-info", sourcesOutputDir);
 
@@ -141,23 +137,22 @@ public class YangModuleInfoCompilationTest {
             }
         }
         assertNotNull(infoImport);
-        assertThat(infoImport.getYangTextCharSource().readFirstLine(), startsWith("module import-module"));
+        assertThat(infoImport.getYangTextCharSource().readFirstLine()).startsWith("module import-module");
         assertNotNull(infoSub1);
-        assertThat(infoSub1.getYangTextCharSource().readFirstLine(), startsWith("submodule submodule1"));
+        assertThat(infoSub1.getYangTextCharSource().readFirstLine()).startsWith("submodule submodule1");
         assertNotNull(infoSub2);
-        assertThat(infoSub2.getYangTextCharSource().readFirstLine(), startsWith("submodule submodule2"));
+        assertThat(infoSub2.getYangTextCharSource().readFirstLine()).startsWith("submodule submodule2");
         assertNotNull(infoSub3);
-        assertThat(infoSub3.getYangTextCharSource().readFirstLine(), startsWith("submodule submodule3"));
+        assertThat(infoSub3.getYangTextCharSource().readFirstLine()).startsWith("submodule submodule3");
 
         cleanUp(sourcesOutputDir, compiledOutputDir);
     }
 
     private static void generateTestSources(final String resourceDirPath, final File sourcesOutputDir)
             throws Exception {
-        final List<File> sourceFiles = getSourceFiles(resourceDirPath);
-        final EffectiveModelContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
-        final Table<GeneratedFileType, GeneratedFilePath, GeneratedFile> codegen = new JavaFileGenerator(Map.of())
-            .generateFiles(context, Set.copyOf(context.getModules()),
+        final var sourceFiles = getSourceFiles(resourceDirPath);
+        final var context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final var codegen = new JavaFileGenerator(Map.of()).generateFiles(context, Set.copyOf(context.getModules()),
                 (module, representation) -> Optional.of(resourceDirPath + File.separator + module.getName()
                     + YangConstants.RFC6020_YANG_FILE_EXTENSION));
 
@@ -165,19 +160,19 @@ public class YangModuleInfoCompilationTest {
         assertEquals(14, codegen.row(GeneratedFileType.SOURCE).size());
         assertEquals(1, codegen.row(GeneratedFileType.RESOURCE).size());
 
-        for (Entry<GeneratedFilePath, GeneratedFile> entry : codegen.row(GeneratedFileType.SOURCE).entrySet()) {
-            final Path path = new File(sourcesOutputDir,
+        for (var entry : codegen.row(GeneratedFileType.SOURCE).entrySet()) {
+            final var path = new File(sourcesOutputDir,
                 entry.getKey().getPath().replace(GeneratedFilePath.SEPARATOR, File.separatorChar)).toPath();
 
             Files.createDirectories(path.getParent());
-            try (OutputStream out = Files.newOutputStream(path)) {
+            try (var out = Files.newOutputStream(path)) {
                 entry.getValue().writeBody(out);
             }
         }
     }
 
     @Test
-    public void generateTestSourcesWithAdditionalConfig() throws Exception {
+    void generateTestSourcesWithAdditionalConfig() throws Exception {
         final List<File> sourceFiles = getSourceFiles("/yang-module-info");
         final EffectiveModelContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         JavaFileGenerator codegen = new JavaFileGenerator(Map.of("test", "test"));
@@ -271,5 +266,4 @@ public class YangModuleInfoCompilationTest {
             }
         }
     }
-
 }