Skip to content

Commit

Permalink
[INJIWEB-1106]: Build Error Fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Kamlesh Singh Bisht <[email protected]>
  • Loading branch information
kamlesh012 committed Nov 27, 2024
1 parent 0d4db99 commit eaf842a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import io.mosip.vercred.vcverifier.constants.CredentialFormat;
import io.mosip.vercred.vcverifier.data.VerificationResult;
import jakarta.annotation.PostConstruct;
import jakarta.validation.valid;
import lombok.extern.slf4j.Slf4j;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
Expand Down Expand Up @@ -182,7 +181,7 @@ private static LinkedHashMap<String, Object> loadDisplayPropertiesFromWellknown(
Map<String, CredentialDisplayResponseDto> credentialSubject = credentialsSupportedResponse.getCredentialDefinition().getCredentialSubject();
// credentialSubject.keySet().forEach(VCProperty -> vcPropertiesFromWellKnown.put(VCProperty, credentialSubject.get(VCProperty).getDisplay().get(0).getName()));
credentialSubject.keySet().forEach(VCProperty -> {
Optional<@Valid CredentialIssuerDisplayResponse> filteredResponse = credentialSubject.get(VCProperty).getDisplay().stream().filter(obj -> obj.getLocale().equals(locale)).findFirst();
Optional<CredentialIssuerDisplayResponse> filteredResponse = credentialSubject.get(VCProperty).getDisplay().stream().filter(obj -> obj.getLocale().equals(locale)).findFirst();
String filteredValue = filteredResponse.isPresent() ? filteredResponse.get().getName() : "" ;
vcPropertiesFromWellKnown.put(VCProperty, filteredValue);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void downloadPDFSuccessfully() throws Exception {
TokenResponseDTO tokenResponseDTO = TestUtilities.getTokenResponseDTO();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("test-data".getBytes());
Mockito.when(credentialService.getTokenResponse(Mockito.anyMap(), Mockito.eq(issuer))).thenReturn(tokenResponseDTO);
Mockito.when(credentialService.downloadCredentialAsPDF(Mockito.eq(issuer), Mockito.eq(credential), Mockito.eq(tokenResponseDTO), Mockito.eq("3"))).thenReturn(byteArrayInputStream);
Mockito.when(credentialService.downloadCredentialAsPDF(Mockito.eq(issuer), Mockito.eq(credential), Mockito.eq(tokenResponseDTO), Mockito.eq("3"),Mockito.eq("en"))).thenReturn(byteArrayInputStream);

mockMvc.perform(post("/credentials/download")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
Expand All @@ -57,6 +57,7 @@ public void downloadPDFSuccessfully() throws Exception {
new BasicNameValuePair("code_verifier", "test-code_verifier"),
new BasicNameValuePair("issuer", issuer),
new BasicNameValuePair("vcStorageExpiryLimitInTimes", "3"),
new BasicNameValuePair("locale", "en"),
new BasicNameValuePair("credential", credential)
)))))
.andExpect(status().isOk())
Expand All @@ -83,6 +84,7 @@ public void throwExceptionWhenTokenIsNotFetched() throws Exception {
new BasicNameValuePair("code_verifier", "test-code_verifier"),
new BasicNameValuePair("issuer", issuer),
new BasicNameValuePair("vcStorageExpiryLimitInTimes", "3"),
new BasicNameValuePair("locale", "en"),
new BasicNameValuePair("credential", credential)
)))))
.andExpect(status().isBadRequest())
Expand All @@ -98,7 +100,7 @@ public void throwExceptionWhenPDFGenerationFailed() throws Exception {
String credential = "test-credential";
TokenResponseDTO tokenResponseDTO = TestUtilities.getTokenResponseDTO();
Mockito.when(credentialService.getTokenResponse(Mockito.anyMap(), Mockito.eq(issuer))).thenReturn(tokenResponseDTO);
Mockito.when(credentialService.downloadCredentialAsPDF(Mockito.eq(issuer), Mockito.eq(credential), Mockito.eq(tokenResponseDTO), Mockito.eq("3") )).thenThrow(ApiNotAccessibleException.class);
Mockito.when(credentialService.downloadCredentialAsPDF(Mockito.eq(issuer), Mockito.eq(credential), Mockito.eq(tokenResponseDTO), Mockito.eq("3"),Mockito.eq("en") )).thenThrow(ApiNotAccessibleException.class);

mockMvc.perform(post("/credentials/download")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
Expand All @@ -109,6 +111,7 @@ public void throwExceptionWhenPDFGenerationFailed() throws Exception {
new BasicNameValuePair("code_verifier", "test-code_verifier"),
new BasicNameValuePair("issuer", issuer),
new BasicNameValuePair("vcStorageExpiryLimitInTimes", "3"),
new BasicNameValuePair("locale", "en"),
new BasicNameValuePair("credential", credential)
)))))
.andExpect(status().isBadRequest())
Expand Down

0 comments on commit eaf842a

Please sign in to comment.