Search in sources :

Example 6 with ChatThreadProperties

use of com.azure.android.communication.chat.models.ChatThreadProperties in project azure-sdk-for-android by Azure.

the class ChatThreadAsyncClientTest method getNotFoundOnNonExistingChatThread.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void getNotFoundOnNonExistingChatThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
    setupTest(httpClient);
    ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
        CompletableFuture<ChatThreadProperties> completableFuture = client.getChatThreadClient("19:00000000000000000000000000000000@thread.v2").getProperties();
        completableFuture.get();
    });
    Throwable cause = executionException.getCause();
    assertNotNull(cause);
    assertTrue(cause instanceof ChatErrorResponseException);
    ChatErrorResponseException exception = (ChatErrorResponseException) cause;
    assertNotNull(exception.getResponse());
    assertEquals(404, exception.getResponse().getStatusCode());
}
Also used : ChatErrorResponseException(com.azure.android.communication.chat.models.ChatErrorResponseException) ChatThreadProperties(com.azure.android.communication.chat.models.ChatThreadProperties) ExecutionException(java.util.concurrent.ExecutionException) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

ChatThreadProperties (com.azure.android.communication.chat.models.ChatThreadProperties)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 MethodSource (org.junit.jupiter.params.provider.MethodSource)5 CreateChatThreadOptions (com.azure.android.communication.chat.models.CreateChatThreadOptions)3 CreateChatThreadResult (com.azure.android.communication.chat.models.CreateChatThreadResult)3 ExecutionException (java.util.concurrent.ExecutionException)2 ChatErrorResponseException (com.azure.android.communication.chat.models.ChatErrorResponseException)1 ChatParticipant (com.azure.android.communication.chat.models.ChatParticipant)1 CommunicationUserIdentifier (com.azure.android.communication.common.CommunicationUserIdentifier)1 Response (com.azure.android.core.rest.Response)1 ArrayList (java.util.ArrayList)1