Migrate common module to JUnit5
[transportpce.git] / common / src / test / java / org / opendaylight / transportpce / common / service / ServiceTypeTest.java
index 91a312142c754db960191a506b1af8921369a6b6..b2fa4d60fa4563dd4a6fd0e9e201a47145c81b4e 100644 (file)
@@ -8,12 +8,13 @@
 
 package org.opendaylight.transportpce.common.service;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
 
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.mapping.MappingBuilder;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import org.junit.jupiter.api.Test;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.PortQual;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes;
 import org.opendaylight.yangtools.yang.common.Uint32;
@@ -21,42 +22,42 @@ import org.opendaylight.yangtools.yang.common.Uint32;
 public class ServiceTypeTest {
 
     @Test
-    public void getServiceTypeForServiceFormatUnknownTest() {
+    void getServiceTypeForServiceFormatUnknownTest() {
         String serviceType = ServiceTypes.getServiceType("toto", null, null);
-        assertNull("service-type should be null", serviceType);
+        assertNull(serviceType, "service-type should be null");
     }
 
     @Test
-    public void getServiceTypeForServiceFormatOCTest() {
+    void getServiceTypeForServiceFormatOCTest() {
         String serviceType = ServiceTypes.getServiceType("OC", Uint32.valueOf(100), null);
-        assertEquals("service-type should be 100GEt", "100GEt", serviceType);
+        assertEquals("100GEt", serviceType, "service-type should be 100GEt");
         serviceType = ServiceTypes.getServiceType("OC", null, null);
-        assertNull("service-type should be null", serviceType);
+        assertNull(serviceType, "service-type should be null");
     }
 
     @Test
-    public void getServiceTypeForServiceFormatEthernetTest() {
+    void getServiceTypeForServiceFormatEthernetTest() {
         String serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(400), null);
-        assertEquals("service-type should be 400GE", "400GE", serviceType);
+        assertEquals("400GE", serviceType, "service-type should be 400GE");
         serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(100), null);
-        assertEquals("service-type should be 100GEt", "100GEt", serviceType);
+        assertEquals("100GEt", serviceType, "service-type should be 100GEt");
         Mapping mapping = new MappingBuilder()
             .setLogicalConnectionPoint("logicalConnectionPoint")
             .setPortQual(PortQual.XpdrClient.getName())
             .build();
         serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(100), mapping);
-        assertEquals("service-type should be 100GEt", "100GEt", serviceType);
+        assertEquals("100GEt", serviceType, "service-type should be 100GEt");
 
         mapping = new MappingBuilder()
             .setLogicalConnectionPoint("logicalConnectionPoint")
             .setPortQual(PortQual.SwitchClient.getName())
             .build();
         serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(100), mapping);
-        assertEquals("service-type should be 100GEm", "100GEm", serviceType);
+        assertEquals("100GEm", serviceType, "service-type should be 100GEm");
         serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(10), mapping);
-        assertEquals("service-type should be 10GE", "10GE", serviceType);
+        assertEquals("10GE", serviceType, "service-type should be 10GE");
         serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(1), mapping);
-        assertEquals("service-type should be 1GE", "1GE", serviceType);
+        assertEquals("1GE", serviceType, "service-type should be 1GE");
 
         mapping = new MappingBuilder()
             .setLogicalConnectionPoint("logicalConnectionPoint")
@@ -64,31 +65,30 @@ public class ServiceTypeTest {
             .setXponderType(XpdrNodeTypes.Switch)
             .build();
         serviceType = ServiceTypes.getServiceType("Ethernet", Uint32.valueOf(100), mapping);
-        assertEquals("service-type should be 100GEs", "100GEs", serviceType);
+        assertEquals("100GEs", serviceType, "service-type should be 100GEs");
     }
 
     @Test
-    public void getOtnServiceTypeForServiceFormatEthernetTest() {
+    void getOtnServiceTypeForServiceFormatEthernetTest() {
         String serviceType = ServiceTypes.getOtnServiceType("toto", Uint32.valueOf(123));
-        assertNull("service-type should be null", serviceType);
+        assertNull(serviceType, "service-type should be null");
         serviceType = ServiceTypes.getOtnServiceType("Ethernet", Uint32.valueOf(123));
-        assertNull("service-type should be null", serviceType);
+        assertNull(serviceType, "service-type should be null");
         serviceType = ServiceTypes.getOtnServiceType("Ethernet", Uint32.valueOf(1));
-        assertEquals("service-type should be 1GE", "1GE", serviceType);
+        assertEquals("1GE", serviceType, "service-type should be 1GE");
         serviceType = ServiceTypes.getOtnServiceType("Ethernet", Uint32.valueOf(10));
-        assertEquals("service-type should be 10GE", "10GE", serviceType);
+        assertEquals("10GE", serviceType, "service-type should be 10GE");
         serviceType = ServiceTypes.getOtnServiceType("Ethernet", Uint32.valueOf(100));
-        assertEquals("service-type should be 100GEm", "100GEm", serviceType);
+        assertEquals("100GEm", serviceType, "service-type should be 100GEm");
 
         serviceType = ServiceTypes.getOtnServiceType("OTU", Uint32.valueOf(100));
-        assertEquals("service-type should be OTU4", "OTU4", serviceType);
+        assertEquals("OTU4", serviceType, "service-type should be OTU4");
         serviceType = ServiceTypes.getOtnServiceType("OTU", Uint32.valueOf(400));
-        assertEquals("service-type should be OTUC4", "OTUC4", serviceType);
+        assertEquals("OTUC4", serviceType, "service-type should be OTUC4");
 
         serviceType = ServiceTypes.getOtnServiceType("ODU", Uint32.valueOf(100));
-        assertEquals("service-type should be ODU4", "ODU4", serviceType);
+        assertEquals("ODU4", serviceType, "service-type should be ODU4");
         serviceType = ServiceTypes.getOtnServiceType("ODU", Uint32.valueOf(400));
-        assertEquals("service-type should be ODUC4", "ODUC4", serviceType);
+        assertEquals("ODUC4", serviceType, "service-type should be ODUC4");
     }
-
 }
\ No newline at end of file