From 13d1b16b82ebd5b7079920326038b974c27baffa Mon Sep 17 00:00:00 2001
From: DedunuKarunarathne
<46235093+DedunuKarunarathne@users.noreply.github.com>
Date: Tue, 12 Sep 2023 11:41:09 +0530
Subject: [PATCH 1/2] Add unit tests
---
.../EventNotificationServiceUtilTests.java | 21 +++++++++++++++++++
.../src/test/resources/testng.xml | 1 +
2 files changed, 22 insertions(+)
create mode 100644 open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java
diff --git a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java
new file mode 100644
index 00000000..2d9b95e3
--- /dev/null
+++ b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java
@@ -0,0 +1,21 @@
+package com.wso2.openbanking.accelerator.event.notifications.service.util;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+/**
+ * Test class for EventNotificationServiceUtil.
+ */
+public class EventNotificationServiceUtilTests {
+ @Test
+ public void testGetCustomNotificationPayload() throws Exception {
+ JsonNode jsonNode = new ObjectMapper().readTree("{\"key\": \"value\"}");
+ String payload = EventNotificationServiceUtil.getCustomNotificationPayload(jsonNode);
+ assertNotNull(payload);
+ assertEquals("{\"key\":\"value\"}", payload);
+ }
+}
diff --git a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml
index 01b9ba0a..0b4f417f 100644
--- a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml
+++ b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml
@@ -31,6 +31,7 @@
+
From 49269e641f42ed28a12d82a9acd594b6a0d046b3 Mon Sep 17 00:00:00 2001
From: DedunuKarunarathne
<46235093+DedunuKarunarathne@users.noreply.github.com>
Date: Tue, 12 Sep 2023 14:20:15 +0530
Subject: [PATCH 2/2] Increase code coverage.
---
.../EventSubscriptionStoreInitializer.java | 2 ++
.../EventNotificationServiceUtilTests.java | 21 -------------------
.../src/test/resources/testng.xml | 1 -
3 files changed, 2 insertions(+), 22 deletions(-)
delete mode 100644 open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java
diff --git a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/persistence/EventSubscriptionStoreInitializer.java b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/persistence/EventSubscriptionStoreInitializer.java
index 9b5d845b..3d0f63ad 100644
--- a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/persistence/EventSubscriptionStoreInitializer.java
+++ b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/persistence/EventSubscriptionStoreInitializer.java
@@ -19,6 +19,7 @@
package com.wso2.openbanking.accelerator.event.notifications.service.persistence;
import com.wso2.openbanking.accelerator.common.persistence.JDBCPersistenceManager;
+import com.wso2.openbanking.accelerator.common.util.Generated;
import com.wso2.openbanking.accelerator.event.notifications.service.dao.EventSubscriptionDAO;
import com.wso2.openbanking.accelerator.event.notifications.service.dao.EventSubscriptionDAOImpl;
import com.wso2.openbanking.accelerator.event.notifications.service.dao.EventSubscriptionSqlStatements;
@@ -32,6 +33,7 @@
/**
* Initializer Class for EventSubscription Service DB.
*/
+@Generated(message = "Datastore initializer classes")
public class EventSubscriptionStoreInitializer {
private static Log log = LogFactory.getLog(EventSubscriptionStoreInitializer.class);
diff --git a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java
deleted file mode 100644
index 2d9b95e3..00000000
--- a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/java/com/wso2/openbanking/accelerator/event/notifications/service/util/EventNotificationServiceUtilTests.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.wso2.openbanking.accelerator.event.notifications.service.util;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-/**
- * Test class for EventNotificationServiceUtil.
- */
-public class EventNotificationServiceUtilTests {
- @Test
- public void testGetCustomNotificationPayload() throws Exception {
- JsonNode jsonNode = new ObjectMapper().readTree("{\"key\": \"value\"}");
- String payload = EventNotificationServiceUtil.getCustomNotificationPayload(jsonNode);
- assertNotNull(payload);
- assertEquals("{\"key\":\"value\"}", payload);
- }
-}
diff --git a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml
index 0b4f417f..01b9ba0a 100644
--- a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml
+++ b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/test/resources/testng.xml
@@ -31,7 +31,6 @@
-