Skip to content

Commit

Permalink
MOSIP-38556 Fixed notification issue via phone channel (mosip#1397)
Browse files Browse the repository at this point in the history
* MOSIP-38556 Fixed notification issue via phone channel

Signed-off-by: kameshsr <[email protected]>

* MOSIP-38556 Added unit test case

Signed-off-by: kameshsr <[email protected]>

---------

Signed-off-by: kameshsr <[email protected]>
  • Loading branch information
kameshsr authored Jan 2, 2025
1 parent 53d40b2 commit 4a193e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void sendSmsNotification(String notificationMobileNo, String message)
RestRequestDTO restRequestDTO = null;
restRequestDTO = restRequestFactory.buildRequest(RestServicesConstants.SMS_NOTIFICATION_SERVICE,
RestRequestFactory.createRequest(smsRequestDto), String.class);
restHelper.requestAsync(restRequestDTO);
} catch (IDDataValidationException e) {
restHelper.requestSync(restRequestDTO);
} catch (IDDataValidationException | RestServiceException e) {
logger.error(IdAuthCommonConstants.SESSION_ID, "Inside SMS Notification >>>>>", e.getErrorCode(), e.getErrorText());
throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.DATA_VALIDATION_FAILED, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;

import io.mosip.idrepository.core.constant.IdRepoErrorConstants;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -116,4 +117,13 @@ public void TestInvalidNotificationConfig() throws IdAuthenticationBusinessExcep
Mockito.when(restHelper.requestAsync(Mockito.any())).thenReturn(Supplier);
notificationManager.sendEmailNotification("[email protected]", "test", "test");
}

@Test(expected = IdAuthenticationBusinessException.class)
public void testInValidSendNotificationPhone() throws IdAuthenticationBusinessException, RestServiceException {
Set<NotificationType> notificationtype = new HashSet<>();
notificationtype.add(NotificationType.SMS);
Mockito.when(restHelper.requestSync(Mockito.any()))
.thenThrow(new RestServiceException(IdRepoErrorConstants.UNKNOWN_ERROR));
notificationManager.sendSmsNotification("1234567890", "test");
}
}

0 comments on commit 4a193e7

Please sign in to comment.