mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 15:38:07 +01:00
Make username-related operations asynchronous
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2023 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
||||
public class CompletableFutureTestUtil {
|
||||
|
||||
private CompletableFutureTestUtil() {
|
||||
}
|
||||
|
||||
public static <T extends Throwable> void assertFailsWithCause(final Class<T> expectedCause, final CompletableFuture<?> completableFuture) {
|
||||
assertFailsWithCause(expectedCause, completableFuture, null);
|
||||
}
|
||||
|
||||
public static <T extends Throwable> void assertFailsWithCause(final Class<T> expectedCause, final CompletableFuture<?> completableFuture, final String message) {
|
||||
final CompletionException completionException = assertThrows(CompletionException.class, completableFuture::join, message);
|
||||
assertTrue(ExceptionUtils.unwrap(completionException).getClass().isAssignableFrom(expectedCause), message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user