Search in sources :

Example 11 with ChatParticipant

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

the class ChatThreadAsyncClientTest method cannotAddParticipantsWithResponseWithInvalidUser.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotAddParticipantsWithResponseWithInvalidUser(HttpClient httpClient) throws InterruptedException, ExecutionException {
    setupTest(httpClient);
    Iterable<ChatParticipant> participants = addParticipants("8:acs:invalidUserId", this.secondThreadParticipant.getId());
    ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
        this.chatThreadClient.addParticipantsWithResponse(participants, null).get();
    });
    Throwable cause = executionException.getCause();
    assertNotNull(cause);
    assertTrue(cause instanceof ChatErrorResponseException);
    ChatErrorResponseException exception = (ChatErrorResponseException) cause;
    assertNotNull(exception.getResponse());
    assertEquals(400, exception.getResponse().getStatusCode());
}
Also used : ChatErrorResponseException(com.azure.android.communication.chat.models.ChatErrorResponseException) ChatParticipant(com.azure.android.communication.chat.models.ChatParticipant) ExecutionException(java.util.concurrent.ExecutionException) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

ChatParticipant (com.azure.android.communication.chat.models.ChatParticipant)11 ArrayList (java.util.ArrayList)7 CommunicationUserIdentifier (com.azure.android.communication.common.CommunicationUserIdentifier)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 ListParticipantsOptions (com.azure.android.communication.chat.models.ListParticipantsOptions)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 ExecutionException (java.util.concurrent.ExecutionException)4 ChatErrorResponseException (com.azure.android.communication.chat.models.ChatErrorResponseException)2 CreateChatThreadOptions (com.azure.android.communication.chat.models.CreateChatThreadOptions)2 AddChatParticipantsResult (com.azure.android.communication.chat.models.AddChatParticipantsResult)1 ChatThreadProperties (com.azure.android.communication.chat.models.ChatThreadProperties)1 CreateChatThreadResult (com.azure.android.communication.chat.models.CreateChatThreadResult)1 StringJoiner (java.util.StringJoiner)1