diff options
author | 2022-08-03 02:44:04 +0000 | |
---|---|---|
committer | 2022-08-03 02:44:04 +0000 | |
commit | 0fa823de11b9b2d0980275247dfd9e597f9dc915 (patch) | |
tree | efe7f820d141c98ed1635b8a092e5b48fc638522 /components/slice-analysis-ms/src/test/java/org/onap/slice/analysis | |
parent | f7371ed8b15bd23d5b63ca4808da7d1673bac46a (diff) |
Revert "Fix bug in handleNotification function and improve test code coverage"
This reverts commit f7371ed8b15bd23d5b63ca4808da7d1673bac46a.
Reason for revert: @Autowired instance does not need to be created manually.
Issue-ID: DCAEGEN2-3208
Change-Id: Iba33e54241925189c5abbb0590452c47d29b0e11
Signed-off-by: qingshuting <qingshuting1@huawei.com>
Diffstat (limited to 'components/slice-analysis-ms/src/test/java/org/onap/slice/analysis')
-rw-r--r-- | components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java index beb11998..74f75a8c 100644 --- a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java @@ -22,17 +22,14 @@ package org.onap.slice.analysis.ms.dmaap; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.mockito.Spy; -import org.onap.slice.analysis.ms.models.Configuration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.google.gson.Gson; -import com.google.gson.JsonObject; + import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -46,26 +43,21 @@ public class VesNotificationCallbackTest { @InjectMocks VesNotificationCallback vesNotificationCallback; - @Before - public void init() throws IOException { - Configuration configuration = Configuration.getInstance(); - String configAllJson = new String(Files.readAllBytes(Paths.get("src/test/resources/config_all.json"))); - JsonObject configAll = new Gson().fromJson(configAllJson, JsonObject.class); - JsonObject config = configAll.getAsJsonObject("config"); - configuration.updateConfigurationFromJsonObject(config); - vesNotificationCallback.init(); - } - @Test public void initTest() { + vesNotificationCallback.init(); Mockito.verify(vesNotificationCallback, Mockito.atLeastOnce()).init(); } @Test - public void activateCallBackTest() throws Exception{ - String input = new String(Files.readAllBytes(Paths.get("src/test/resources/vesCCVPNNotiModel.json"))); + public void activateCallBackTest() { + String input = null; + try { + input = new String(Files.readAllBytes(Paths.get("src/test/resources/vesCCVPNNotiModel.json"))); + } catch (IOException e) { + e.printStackTrace(); + } vesNotificationCallback.activateCallBack(input); Mockito.verify(vesNotificationCallback, Mockito.atLeastOnce()).activateCallBack(Mockito.anyString()); } - } |