### Question:
PushNotificationResourceClientImpl extends AbstractResourceClient implements PushNotificationResourceClient { @Nonnull @Override public ResultResponseModel<CreatePushNotificationResponse> createPushNotification(@Nonnull final CreatePushNotificationRequest request) { return createPushNotificationInternal(request, null); } PushNotificationResourceClientImpl(final Client client, final String apiPath); @Nonnull @Override ResultResponseModel<CreatePushNotificationResponse> createPushNotification(@Nonnull final CreatePushNotificationRequest request); @Nonnull @Override ResultResponseModel<CreatePushNotificationResponse> createPushNotification(@Nonnull final CreatePushNotificationRequest request, @Nonnull final String authToken); @Nonnull @Override ResultResponseModel<UpdatePushNotificationSubscriptionResponse> updatePushNotificationSubscription(@Nonnull final UpdatePushNotificationSubscriptionRequest request);  }### Answer:
@Test public void testCreatePushNotificationWithInvalidArgument() { assertThatThrownBy(() -> pushNotificationResourceClient.createPushNotification(null)); assertThatThrownBy(() -> pushNotificationResourceClient.createPushNotification(new CreatePushNotificationRequest(), null)); }
@Test public void testCreatePushNotificationWithAuthorization() { final CreatePushNotificationRequest request = new CreatePushNotificationRequest(); final String authToken = uuid(); final WebTarget webTarget = createMock(WebTarget.class); final Invocation.Builder requestBuilder = createMock(Invocation.Builder.class); final ResultResponseModel<CreatePushNotificationResponse> resultResponseModel = new ResultResponseModel<>(new CreatePushNotificationResponse()); expect(client.target(apiPath)).andReturn(webTarget); expect(webTarget.path("notification/push/create")).andReturn(webTarget); expect(webTarget.request(MediaType.APPLICATION_JSON_TYPE)).andReturn(requestBuilder); expect(requestBuilder.header("Authorization", "Bearer " + authToken)).andReturn(requestBuilder); expect(requestBuilder.post(eq(Entity.entity(request, MediaType.APPLICATION_JSON_TYPE)), isA(GenericType.class))).andReturn(resultResponseModel); replayAll(); assertThat(pushNotificationResourceClient.createPushNotification(request, authToken)).isEqualTo(resultResponseModel); verifyAll(); }
@Test public void testCreatePushNotification() { final CreatePushNotificationRequest request = new CreatePushNotificationRequest(); final WebTarget webTarget = createMock(WebTarget.class); final Invocation.Builder requestBuilder = createMock(Invocation.Builder.class); final ResultResponseModel<CreatePushNotificationResponse> resultResponseModel = new ResultResponseModel<>(new CreatePushNotificationResponse()); expect(client.target(apiPath)).andReturn(webTarget); expect(webTarget.path("notification/push/create")).andReturn(webTarget); expect(webTarget.request(MediaType.APPLICATION_JSON_TYPE)).andReturn(requestBuilder); expect(requestBuilder.post(eq(Entity.entity(request, MediaType.APPLICATION_JSON_TYPE)), isA(GenericType.class))).andReturn(resultResponseModel); replayAll(); assertThat(pushNotificationResourceClient.createPushNotification(request)).isEqualTo(resultResponseModel); verifyAll(); }