Skip to content

Commit 4a193e7

Browse files
authored
MOSIP-38556 Fixed notification issue via phone channel (#1397)
* 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]>
1 parent 53d40b2 commit 4a193e7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/NotificationManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public void sendSmsNotification(String notificationMobileNo, String message)
5656
RestRequestDTO restRequestDTO = null;
5757
restRequestDTO = restRequestFactory.buildRequest(RestServicesConstants.SMS_NOTIFICATION_SERVICE,
5858
RestRequestFactory.createRequest(smsRequestDto), String.class);
59-
restHelper.requestAsync(restRequestDTO);
60-
} catch (IDDataValidationException e) {
59+
restHelper.requestSync(restRequestDTO);
60+
} catch (IDDataValidationException | RestServiceException e) {
6161
logger.error(IdAuthCommonConstants.SESSION_ID, "Inside SMS Notification >>>>>", e.getErrorCode(), e.getErrorText());
6262
throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.DATA_VALIDATION_FAILED, e);
6363
}

authentication/authentication-common/src/test/java/io/mosip/authentication/common/service/integration/NotificationManagerTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Set;
66
import java.util.concurrent.CompletableFuture;
77

8+
import io.mosip.idrepository.core.constant.IdRepoErrorConstants;
89
import org.junit.Before;
910
import org.junit.Test;
1011
import org.junit.runner.RunWith;
@@ -116,4 +117,13 @@ public void TestInvalidNotificationConfig() throws IdAuthenticationBusinessExcep
116117
Mockito.when(restHelper.requestAsync(Mockito.any())).thenReturn(Supplier);
117118
notificationManager.sendEmailNotification("[email protected]", "test", "test");
118119
}
120+
121+
@Test(expected = IdAuthenticationBusinessException.class)
122+
public void testInValidSendNotificationPhone() throws IdAuthenticationBusinessException, RestServiceException {
123+
Set<NotificationType> notificationtype = new HashSet<>();
124+
notificationtype.add(NotificationType.SMS);
125+
Mockito.when(restHelper.requestSync(Mockito.any()))
126+
.thenThrow(new RestServiceException(IdRepoErrorConstants.UNKNOWN_ERROR));
127+
notificationManager.sendSmsNotification("1234567890", "test");
128+
}
119129
}

0 commit comments

Comments
 (0)