### Question:
PushNotificationSubscriptionRequestServiceImpl implements PushNotificationSubscriptionRequestService { @Nonnull @Override public PushNotificationSubscriptionRequest getPushNotificationSubscriptionRequestById(@Nonnull final Long requestId) { assertPushNotificationSubscriptionRequestId(requestId); LOGGER.debug("Getting push notification subscription request for id - {}", requestId); final PushNotificationSubscriptionRequest request = pushNotificationSubscriptionRequestRepository.findById(requestId) .orElseThrow(() -> new PushNotificationSubscriptionRequestNotFoundForIdException(requestId)); LOGGER.debug("Successfully retrieved push notification subscription request for id - {}, request - {}", request.getId(), request); return request; } PushNotificationSubscriptionRequestServiceImpl(); @Transactional @Nonnull @Override PushNotificationSubscriptionRequest createPushNotificationSubscriptionRequest(@Nonnull final Long userId, @Nonnull final Long userMobileDeviceId, @Nonnull final PushNotificationSubscriptionRequestDto requestDto); @Nonnull @Override PushNotificationSubscriptionRequest getPushNotificationSubscriptionRequestById(@Nonnull final Long requestId); @Transactional @Nonnull @Override PushNotificationSubscriptionRequest updatePushNotificationSubscriptionRequestState(@Nonnull final Long requestId, @Nonnull final PushNotificationSubscriptionRequestState state); @Nonnull @Override PushNotificationSubscriptionRequest getPushNotificationSubscriptionRequestByUuId(@Nonnull final String uuId); @Nonnull @Override boolean checkIfPushNotificationSubscriptionRecipientExistsForUuId(@Nonnull final String uuId); @Transactional @Nonnull @Override PushNotificationSubscriptionRequest updatePushNotificationSubscriptionRequestRecipient(@Nonnull final Long requestId, @Nonnull final Long recipientId); PushNotificationSubscriptionRequestRepository getPushNotificationSubscriptionRequestRepository(); void setPushNotificationSubscriptionRequestRepository(final PushNotificationSubscriptionRequestRepository pushNotificationSubscriptionRequestRepository); UserService getUserService(); void setUserService(final UserService userService); UserDeviceService getUserMobileDeviceService(); void setUserMobileDeviceService(final UserDeviceService userMobileDeviceService); PushNotificationRecipientService getPushNotificationRecipientService(); void setPushNotificationRecipientService(final PushNotificationRecipientService pushNotificationRecipientService);  }### Answer:
@Test public void testGetPushNotificationSubscriptionRequestByIdWithInvalidArguments() { resetAll(); replayAll(); try { pushNotificationSubscriptionRequestService.getPushNotificationSubscriptionRequestById(null); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } verifyAll(); }
@Test public void testGetPushNotificationSubscriptionRequestByIdWithNotExistingId() { final Long requestId = 1L; resetAll(); expect(pushNotificationSubscriptionRequestRepository.findById(eq(requestId))).andReturn(Optional.empty()).once(); replayAll(); try { pushNotificationSubscriptionRequestService.getPushNotificationSubscriptionRequestById(requestId); fail("Exception should be thrown"); } catch (final PushNotificationSubscriptionRequestNotFoundForIdException ex) { assertPushNotificationSubscriptionRequestNotFoundForIdException(ex, requestId); } verifyAll(); }
@Test public void testGetPushNotificationSubscriptionRequestById() { final Long requestId = 1L; final PushNotificationSubscriptionRequest request = getServicesImplTestHelper().createPushNotificationSubscriptionRequest(); request.setId(requestId); resetAll(); expect(pushNotificationSubscriptionRequestRepository.findById(eq(requestId))).andReturn(Optional.of(request)).once(); replayAll(); final PushNotificationSubscriptionRequest result = pushNotificationSubscriptionRequestService.getPushNotificationSubscriptionRequestById(requestId); assertEquals(request, result); verifyAll(); }