use of com.azure.android.communication.chat.models.ChatErrorResponseException in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method cannotDeleteMessageWithInvalidId.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotDeleteMessageWithInvalidId(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
this.chatThreadClient.deleteMessage("invalid_chat_message_id").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 cannotRemoveParticipantWithInvalidUser.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotRemoveParticipantWithInvalidUser(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
this.chatThreadClient.removeParticipant(new CommunicationUserIdentifier("8:acs:invalidUserId")).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 cannotDeleteMessageWithResponseWithInvalidId.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotDeleteMessageWithResponseWithInvalidId(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
this.chatThreadClient.deleteMessageWithResponse("invalid_chat_message_id", 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 cannotCreateThreadWithResponseWithInvalidUser.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotCreateThreadWithResponseWithInvalidUser(HttpClient httpClient) {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions("8:acs:invalidUserId", secondThreadParticipant.getId());
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
client.createChatThreadWithResponse(threadRequest, 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 cannotDeleteChatThreadWithResponseWithInvalidThreadId.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotDeleteChatThreadWithResponseWithInvalidThreadId(HttpClient httpClient) {
setupTest(httpClient);
final String invalidChatThreadId = "invalid_chat_thread_id";
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
client.deleteChatThreadWithResponse(invalidChatThreadId, null).get();
});
Throwable cause = executionException.getCause();
assertNotNull(cause);
assertTrue(cause instanceof ChatErrorResponseException);
ChatErrorResponseException exception = (ChatErrorResponseException) cause;
assertNotNull(exception.getResponse());
assertEquals(400, exception.getResponse().getStatusCode());
}
Aggregations