From 3a78a06d43b2891b1d6a2ba956628b78335d4728 Mon Sep 17 00:00:00 2001 From: Mohd Kaif Siddique Date: Thu, 28 Mar 2024 10:45:38 +0530 Subject: [PATCH] modified initialize_ValidDetails_ThenPass test now locating InsuranceCredential.json with classpath Signed-off-by: Mohd Kaif Siddique --- .../service/SunbirdRCVCIssuancePluginTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sunbird-rc-esignet-integration-impl/src/test/java/io/mosip/esignet/sunbirdrc/integration/service/SunbirdRCVCIssuancePluginTest.java b/sunbird-rc-esignet-integration-impl/src/test/java/io/mosip/esignet/sunbirdrc/integration/service/SunbirdRCVCIssuancePluginTest.java index 7f842b2..1548f8a 100644 --- a/sunbird-rc-esignet-integration-impl/src/test/java/io/mosip/esignet/sunbirdrc/integration/service/SunbirdRCVCIssuancePluginTest.java +++ b/sunbird-rc-esignet-integration-impl/src/test/java/io/mosip/esignet/sunbirdrc/integration/service/SunbirdRCVCIssuancePluginTest.java @@ -27,6 +27,7 @@ import org.springframework.web.client.RestTemplate; import java.io.File; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -261,12 +262,16 @@ public void getVerifiableCredentialWithLinkedDataProof_InValidCredentialDetails_ @Test public void initialize_ValidDetails_ThenPass() throws VCIExchangeException { - File file = new File("src/test/resources/InsuranceCredential.json"); - String credentialPath = "file:/" + file.getAbsolutePath(); + URL credentialUrl = getClass().getClassLoader().getResource("InsuranceCredential.json"); + if (credentialUrl == null) { + throw new VCIExchangeException("InsuranceCredential.json not found in classpath"); + } + String credentialPath = credentialUrl.toString(); Mockito.when(environment.getProperty(Mockito.anyString())).thenReturn(credentialPath); sunbirdRCVCIssuancePlugin.initialize(); } + @Test public void initialize_InValidPropertyDetails_ThenPass() {