Add service listener to notify Kafka
[transportpce.git] / nbinotifications / src / test / java / org / opendaylight / transportpce / nbinotifications / serialization / NotificationServiceSerializerTest.java
index 3fe658b6bdafd1a46c69bf82e1d7a447817310e1..ca11dda9ce0ff2cfbf781190f852f6f345ad43f5 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.transportpce.nbinotifications.serialization;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
@@ -18,7 +20,7 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
@@ -39,6 +41,8 @@ public class NotificationServiceSerializerTest extends AbstractTest {
         serializer.close();
         assertNotNull("Serialized data should not be null", data);
         String expectedJson = Files.readString(Paths.get("src/test/resources/expected_event.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));
     }
 }