use of com.azure.android.communication.chat.models.ChatErrorResponseException in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method cannotAddSingleParticipantWithResponseWithInvalidUser.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotAddSingleParticipantWithResponseWithInvalidUser(HttpClient httpClient) throws InterruptedException, ExecutionException {
setupTest(httpClient);
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
this.chatThreadClient.addParticipantWithResponse(generateParticipant("8:acs:invalidUserId", "name"), null).get();
});
Throwable cause = executionException.getCause();
assertNotNull(cause);
assertTrue(cause instanceof ChatErrorResponseException);
ChatErrorResponseException exception = (ChatErrorResponseException) cause;
assertNotNull(exception.getResponse());
assertEquals(400, exception.getResponse().getStatusCode());
}
use of com.azure.android.communication.chat.models.ChatErrorResponseException in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method cannotUpdateMessageWithInvalidId.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotUpdateMessageWithInvalidId(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
UpdateChatMessageOptions updateMessageRequest = super.updateMessageOptions();
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
this.chatThreadClient.updateMessage("invalid_chat_message_id", updateMessageRequest).get();
});
Throwable cause = executionException.getCause();
assertNotNull(cause);
assertTrue(cause instanceof ChatErrorResponseException);
ChatErrorResponseException exception = (ChatErrorResponseException) cause;
assertNotNull(exception.getResponse());
assertEquals(400, exception.getResponse().getStatusCode());
}
use of com.azure.android.communication.chat.models.ChatErrorResponseException in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method cannotUpdateMessageWithResponseWithInvalidId.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotUpdateMessageWithResponseWithInvalidId(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
UpdateChatMessageOptions updateMessageRequest = super.updateMessageOptions();
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
this.chatThreadClient.updateMessageWithResponse("invalid_chat_message_id", updateMessageRequest, null).get();
});
Throwable cause = executionException.getCause();
assertNotNull(cause);
assertTrue(cause instanceof ChatErrorResponseException);
ChatErrorResponseException exception = (ChatErrorResponseException) cause;
assertNotNull(exception.getResponse());
assertEquals(400, exception.getResponse().getStatusCode());
}
use of com.azure.android.communication.chat.models.ChatErrorResponseException in project azure-sdk-for-android by Azure.
the class ChatAsyncClientTest method cannotDeleteChatThreadWithInvalidThreadId.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotDeleteChatThreadWithInvalidThreadId(HttpClient httpClient) {
setupTest(httpClient);
final String invalidChatThreadId = "invalid_chat_thread_id";
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
client.deleteChatThread(invalidChatThreadId).get();
});
Throwable cause = executionException.getCause();
assertNotNull(cause);
assertTrue(cause instanceof ChatErrorResponseException);
ChatErrorResponseException exception = (ChatErrorResponseException) cause;
assertNotNull(exception.getResponse());
assertEquals(400, exception.getResponse().getStatusCode());
}
Aggregations