Migration to TAPI 2.4 Step2
[transportpce.git] / nbinotifications / src / test / java / org / opendaylight / transportpce / nbinotifications / serialization / NotificationAlarmServiceSerializerTest.java
index b850f5b7956a8bc6a7526929ff42c65fd536cd45..91d4e42f94550c6af21c113ffbde3cff22c9a58e 100755 (executable)
@@ -7,8 +7,7 @@
  */
 package org.opendaylight.transportpce.nbinotifications.serialization;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -17,17 +16,19 @@ import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.Map;
-import org.junit.Test;
+import org.json.JSONException;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.NotificationAlarmService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
+import org.skyscreamer.jsonassert.JSONAssert;
 
 public class NotificationAlarmServiceSerializerTest extends AbstractTest {
 
     @Test
-    public void serializeTest() throws IOException {
+    void serializeTest() throws IOException, JSONException {
         JsonStringConverter<NotificationAlarmService> converter =
                 new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
         String json = Files.readString(Paths.get("src/test/resources/event_alarm_service.json"));
@@ -39,10 +40,10 @@ public class NotificationAlarmServiceSerializerTest extends AbstractTest {
         serializer.configure(configs, false);
         byte[] data = serializer.serialize("test", notificationAlarmService);
         serializer.close();
-        assertNotNull("Serialized data should not be null", data);
+        assertNotNull(data, "Serialized data should not be null");
         String expectedJson = Files.readString(Paths.get("src/test/resources/expected_event_alarm_service.json"));
         // Minify the json string
         expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
-        assertEquals("The event should be equals", expectedJson, new String(data, StandardCharsets.UTF_8));
+        JSONAssert.assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), true);
     }
 }