Merge branch '2.5.x'

Closes gh-26902
pull/26903/head
Andy Wilkinson 3 years ago
commit 3b613a4f2d

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,10 +18,12 @@ package org.springframework.boot.devtools.restart;
import java.net.URL;
import java.net.URLClassLoader;
import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.ThreadFactory;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -80,10 +82,11 @@ class RestarterTests {
Restarter.clearInstance();
Thread thread = new Thread(SampleApplication::main);
thread.start();
Thread.sleep(2600);
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 0")).isGreaterThan(1);
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 1")).isGreaterThan(1);
assertThat(CloseCountingApplicationListener.closed).isGreaterThan(0);
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 0")).isGreaterThan(1);
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 1")).isGreaterThan(1);
assertThat(CloseCountingApplicationListener.closed).isGreaterThan(0);
});
}
@Test

Loading…
Cancel
Save