@SneakyThrows
    private static <T> void assertThatWithSpinWait(Callable<T> actual, Matcher<? super T> matcher, long timeoutMillis) {
        long endMillis = System.currentTimeMillis() + timeoutMillis;
        while (System.currentTimeMillis() < endMillis) {
            try {
                assertThat("", actual.call(), matcher);
                return;
            } catch (AssertionError ignored) {
                // ignore
            }
        }
        assertThat("", actual.call(), matcher);
    }