### Question:
EmailNotificationResourceClientImpl extends AbstractResourceClient implements EmailNotificationResourceClient { @Nonnull @Override public ResultResponseModel<CreateEmailNotificationResponse> createEmailNotification(@Nonnull final CreateEmailNotificationRequest request) { return createEmailNotificationInternal(request, null); } EmailNotificationResourceClientImpl(final Client client, final String apiPath); @Nonnull @Override ResultResponseModel<CreateEmailNotificationResponse> createEmailNotification(@Nonnull final CreateEmailNotificationRequest request); @Nonnull @Override ResultResponseModel<CreateEmailNotificationResponse> createEmailNotification(@Nonnull CreateEmailNotificationRequest request, @Nonnull final String authToken);  }### Answer:
@Test public void testCreateEmailNotificationWithInvalidArgument() { assertThatThrownBy(() -> emailNotificationResourceClient.createEmailNotification(null)); assertThatThrownBy(() -> emailNotificationResourceClient.createEmailNotification(new CreateEmailNotificationRequest(), null)); }
@Test public void testCreateEmailNotificationWithAutorization() { final CreateEmailNotificationRequest request = new CreateEmailNotificationRequest(); final String authToken = uuid(); final WebTarget webTarget = createMock(WebTarget.class); final Invocation.Builder requestBuilder = createMock(Invocation.Builder.class); final ResultResponseModel<CreateEmailNotificationResponse> resultResponseModel = new ResultResponseModel<>(new CreateEmailNotificationResponse()); expect(client.target(apiPath)).andReturn(webTarget); expect(webTarget.path("notification/email/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(emailNotificationResourceClient.createEmailNotification(request, authToken)).isEqualTo(resultResponseModel); verifyAll(); }
@Test public void testCreateEmailNotification() { final CreateEmailNotificationRequest request = new CreateEmailNotificationRequest(); final WebTarget webTarget = createMock(WebTarget.class); final Invocation.Builder requestBuilder = createMock(Invocation.Builder.class); final ResultResponseModel<CreateEmailNotificationResponse> resultResponseModel = new ResultResponseModel<>(new CreateEmailNotificationResponse()); expect(client.target(apiPath)).andReturn(webTarget); expect(webTarget.path("notification/email/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(emailNotificationResourceClient.createEmailNotification(request)).isEqualTo(resultResponseModel); verifyAll(); }