use of com.azure.android.communication.chat.implementation.models.ChatThreadProperties in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canGetExistingChatThreadWithResponse.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canGetExistingChatThreadWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<Response<CreateChatThreadResult>> completableFuture1 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, null);
assertNotNull(completableFuture1);
Response<CreateChatThreadResult> response1 = completableFuture1.get();
assertNotNull(response1);
CreateChatThreadResult result1 = response1.getValue();
assertNotNull(result1);
assertNotNull(result1.getChatThread());
assertNotNull(result1.getChatThread().getId());
String expectedThreadId = result1.getChatThread().getId();
CompletableFuture<Response<ChatThreadProperties>> completableFuture2 = this.client.getChatThreadClient().getChatThreadPropertiesWithResponseAsync(expectedThreadId);
assertNotNull(completableFuture2);
Response<ChatThreadProperties> response2 = completableFuture2.get();
assertNotNull(response2);
ChatThreadProperties result2 = response2.getValue();
assertNotNull(result2);
assertNotNull(result2.getId());
assertEquals(expectedThreadId, result2.getId());
}
use of com.azure.android.communication.chat.implementation.models.ChatThreadProperties in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canGetExistingChatThread.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canGetExistingChatThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<CreateChatThreadResult> completableFuture1 = this.client.getChatClient().createChatThreadAsync(threadRequest, null);
assertNotNull(completableFuture1);
CreateChatThreadResult result1 = completableFuture1.get();
assertNotNull(result1);
assertNotNull(result1.getChatThread());
assertNotNull(result1.getChatThread().getId());
String expectedThreadId = result1.getChatThread().getId();
CompletableFuture<ChatThreadProperties> completableFuture2 = this.client.getChatThreadClient().getChatThreadPropertiesAsync(expectedThreadId);
assertNotNull(completableFuture2);
ChatThreadProperties result2 = completableFuture2.get();
assertNotNull(result2);
assertNotNull(result2.getId());
assertEquals(expectedThreadId, result2.getId());
}
use of com.azure.android.communication.chat.implementation.models.ChatThreadProperties in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method getNotFoundOnNonExistingChatThread.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void getNotFoundOnNonExistingChatThread(HttpClient httpClient) {
setupTest(httpClient);
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
CompletableFuture<ChatThreadProperties> completableFuture = client.getChatThreadClient().getChatThreadPropertiesAsync("19:00000000000000000000000000000000@thread.v2");
completableFuture.get();
});
Throwable cause = executionException.getCause();
assertNotNull(cause);
assertTrue(cause instanceof CommunicationErrorResponseException);
HttpResponseException exception = (HttpResponseException) cause;
assertNotNull(exception.getResponse());
assertEquals(404, exception.getResponse().getStatusCode());
}
Aggregations