Migrate common module to JUnit5
[transportpce.git] / common / src / test / java / org / opendaylight / transportpce / common / mapping / MappingUtilsImplTest.java
index a9a72c51e873a353b4b1beab1652110c70954961..acbb77d708f5c1e107cacfd429a0704986b13de5 100644 (file)
@@ -8,10 +8,11 @@
 
 package org.opendaylight.transportpce.common.mapping;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-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.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.FileNotFoundException;
 import java.io.FileReader;
@@ -19,8 +20,8 @@ import java.io.IOException;
 import java.io.Reader;
 import java.nio.charset.StandardCharsets;
 import java.util.concurrent.ExecutionException;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.mdsal.binding.api.WriteTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.StringConstants;
@@ -38,8 +39,8 @@ public class MappingUtilsImplTest extends AbstractTest {
     private static final Logger LOG = LoggerFactory.getLogger(MappingUtilsImplTest.class);
     private static MappingUtils mappingUtils;
 
-    @BeforeClass
-    public static void setUp() throws InterruptedException, ExecutionException, FileNotFoundException {
+    @BeforeAll
+    static void setUp() throws InterruptedException, ExecutionException, FileNotFoundException {
         DataObjectConverter dataObjectConverter = JSONDataObjectConverter
                 .createWithDataStoreUtil(getDataStoreContextUtil());
         try (Reader reader = new FileReader("src/test/resources/network.json", StandardCharsets.UTF_8)) {
@@ -60,23 +61,19 @@ public class MappingUtilsImplTest extends AbstractTest {
     }
 
     @Test
-    public void getOpenRoadmVersionTest() throws ExecutionException, InterruptedException {
-        assertEquals("NodeInfo with ROADM-C1 as id should be 1.2.1 version",
-                StringConstants.OPENROADM_DEVICE_VERSION_1_2_1,
-                mappingUtils.getOpenRoadmVersion("ROADM-C1"));
-        assertEquals("NodeInfo with ROADM-A1 as id should be 2.2.1 version",
-                StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
-                mappingUtils.getOpenRoadmVersion("ROADM-A1"));
-        assertNull("NodeInfo with nodes3 as id should not exist", mappingUtils.getOpenRoadmVersion("nodes3"));
+    void getOpenRoadmVersionTest() throws ExecutionException, InterruptedException {
+        assertEquals(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1, mappingUtils.getOpenRoadmVersion("ROADM-C1"),
+            "NodeInfo with ROADM-C1 as id should be 1.2.1 version");
+        assertEquals(StringConstants.OPENROADM_DEVICE_VERSION_2_2_1, mappingUtils.getOpenRoadmVersion("ROADM-A1"),
+            "NodeInfo with ROADM-A1 as id should be 2.2.1 version");
+        assertNull(mappingUtils.getOpenRoadmVersion("nodes3"), "NodeInfo with nodes3 as id should not exist");
     }
 
     @Test
-    public void getMcCapabilitiesForNodeTest() {
-        assertEquals("Mc capabilities list size should be 2", 2,
-                mappingUtils.getMcCapabilitiesForNode("ROADM-A1").size());
-        assertTrue("Mc capabilities list size should be empty",
-                mappingUtils.getMcCapabilitiesForNode("ROADM-A2").isEmpty());
+    void getMcCapabilitiesForNodeTest() {
+        assertEquals(2, mappingUtils.getMcCapabilitiesForNode("ROADM-A1").size(),
+            "Mc capabilities list size should be 2");
+        assertTrue(mappingUtils.getMcCapabilitiesForNode("ROADM-A2").isEmpty(),
+            "Mc capabilities list size should be empty");
     }
-
-
 }