### Question:
SmsNotificationProcessorImpl implements SmsNotificationProcessor { @Override public void processNotification(@Nonnull final Long notificationId, @Nonnull final Map<String, String> secureProperties) { Assert.notNull(notificationId, "Sms notification id should not be null"); Assert.notNull(secureProperties, "Secure properties map should not be null"); final SmsNotification smsNotification = smsNotificationService.getSmsNotificationForProcessing(notificationId); assertNotificationStateIsCreated(smsNotification); logger.debug("Successfully retrieved sms notification - {}", smsNotification); updateSmsNotificationState(smsNotification.getId(), NotificationState.PROCESSING); try { processSending(smsNotification, secureProperties); } catch (final Exception e) { final String message = "Error occurred while sending sms message to recipient - " + smsNotification.getRecipientMobileNumber(); logger.error(message, e); updateSmsNotificationState(smsNotification.getId(), NotificationState.FAILED); throw new ServicesRuntimeException(message, e); } } SmsNotificationProcessorImpl(final SmsNotificationService smsNotificationService,
                                 final SmsSenderProvider smsSenderProvider,
                                 @Value("${sms.sender:}") final String senderName); @Override void processNotification(@Nonnull final Long notificationId, @Nonnull final Map<String, String> secureProperties);  }### Answer:
@Test public void testProcessSmsMessageWithInvalidArguments() { resetAll(); replayAll(); try { smsMessageProcessingService.processNotification(null, Collections.emptyMap()); fail("Exception"); } catch (final IllegalArgumentException e) { } try { final Long notificationId = 1L; smsMessageProcessingService.processNotification(notificationId, null); fail("Exception"); } catch (final IllegalArgumentException e) { } verifyAll(); }
@Test public void testProcessSmsMessageWithInvalidNotificationState() { final Long notificationId = 1l; final SmsNotification smsNotification = getServicesImplTestHelper().createSmsNotification(); smsNotification.setId(notificationId); smsNotification.setState(NotificationState.PROCESSING); resetAll(); expect(smsNotificationService.getSmsNotificationForProcessing(notificationId)).andReturn(smsNotification).once(); replayAll(); try { smsMessageProcessingService.processNotification(notificationId, Collections.emptyMap()); fail("Exception"); } catch (final IllegalArgumentException e) { } verifyAll(); }