### Question:
AmazonSnsPushMessageSubscriber implements PushMessageSubscriber { @Override public String refreshDeviceEndpointArn(final String existingDeviceEndpointArn, final String userDeviceToken, final String applicationArn) { Assert.hasText(existingDeviceEndpointArn, "Null or empty text was passed as an argument for parameter 'existingDeviceEndpointArn'."); assertValidDeviceTokenAndAplicationArn(userDeviceToken, applicationArn); return refreshDeviceEndpointArnInternal(existingDeviceEndpointArn, userDeviceToken, applicationArn); } AmazonSnsPushMessageSubscriber(final AmazonSnsApiCommunicator amazonSnsApiCommunicator); @Override String refreshDeviceEndpointArn(final String existingDeviceEndpointArn, final String userDeviceToken, final String applicationArn); @Override String registerDeviceEndpointArn(final String userDeviceToken, final String applicationArn);  }### Answer:
@Test public void testRefreshDeviceEndpointArnWithInvalidArguments() { Assertions.assertThatThrownBy(() -> messageSubscriber.refreshDeviceEndpointArn(null, uuid(), uuid())) .isInstanceOf(IllegalArgumentException.class); Assertions.assertThatThrownBy(() -> messageSubscriber.refreshDeviceEndpointArn(uuid(), null, uuid())) .isInstanceOf(IllegalArgumentException.class); Assertions.assertThatThrownBy(() -> messageSubscriber.refreshDeviceEndpointArn(uuid(), uuid(), null)) .isInstanceOf(IllegalArgumentException.class); }
@Test public void testRefreshDeviceEndpointArnExistingTokenValid() { final String existingDeviceEndpointArn = uuid(); final String userDeviceToken = uuid(); final String applicationArn = uuid(); final GetDeviceEndpointAttributesRequest request = new GetDeviceEndpointAttributesRequest(existingDeviceEndpointArn); final GetDeviceEndpointAttributesResponse response = new GetDeviceEndpointAttributesResponse(existingDeviceEndpointArn,userDeviceToken,true,true); when(amazonSnsApiCommunicator.getDeviceEndpointAttributes(request)).thenReturn(response); assertThat( messageSubscriber.refreshDeviceEndpointArn(existingDeviceEndpointArn, userDeviceToken, applicationArn)).isEqualTo(existingDeviceEndpointArn); verify(amazonSnsApiCommunicator).getDeviceEndpointAttributes(request); }