Polish output capture names

This commit is contained in:
Phillip Webb
2019-07-14 18:07:47 +01:00
parent cdf43a7489
commit c3816bfe7b
73 changed files with 328 additions and 335 deletions

View File

@@ -78,21 +78,21 @@ class RemoteClientConfigurationTests {
}
@Test
void warnIfRestartDisabled(CapturedOutput capturedOutput) {
void warnIfRestartDisabled(CapturedOutput output) {
configure("spring.devtools.remote.restart.enabled:false");
assertThat(capturedOutput).contains("Remote restart is disabled");
assertThat(output).contains("Remote restart is disabled");
}
@Test
void warnIfNotHttps(CapturedOutput capturedOutput) {
void warnIfNotHttps(CapturedOutput output) {
configure("http://localhost", true);
assertThat(capturedOutput).contains("is insecure");
assertThat(output).contains("is insecure");
}
@Test
void doesntWarnIfUsingHttps(CapturedOutput capturedOutput) {
void doesntWarnIfUsingHttps(CapturedOutput output) {
configure("https://localhost", true);
assertThat(capturedOutput).doesNotContain("is insecure");
assertThat(output).doesNotContain("is insecure");
}
@Test

View File

@@ -80,11 +80,11 @@ class RestartApplicationListenerTests {
}
@Test
void disableWithSystemProperty(CapturedOutput capturedOutput) {
void disableWithSystemProperty(CapturedOutput output) {
System.setProperty(ENABLED_PROPERTY, "false");
testInitialize(false);
assertThat(Restarter.getInstance()).hasFieldOrPropertyWithValue("enabled", false);
assertThat(capturedOutput).contains("Restart disabled due to System property");
assertThat(output).contains("Restart disabled due to System property");
}
private void testInitialize(boolean failed) {

View File

@@ -76,14 +76,13 @@ class RestarterTests {
}
@Test
void testRestart(CapturedOutput capturedOutput) throws Exception {
void testRestart(CapturedOutput output) throws Exception {
Restarter.clearInstance();
Thread thread = new Thread(SampleApplication::main);
thread.start();
Thread.sleep(2600);
String output = capturedOutput.toString();
assertThat(StringUtils.countOccurrencesOf(output, "Tick 0")).isGreaterThan(1);
assertThat(StringUtils.countOccurrencesOf(output, "Tick 1")).isGreaterThan(1);
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 0")).isGreaterThan(1);
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 1")).isGreaterThan(1);
assertThat(CloseCountingApplicationListener.closed).isGreaterThan(0);
}

View File

@@ -139,11 +139,11 @@ class HttpTunnelConnectionTests {
}
@Test
void connectFailureLogsWarning(CapturedOutput capturedOutput) throws Exception {
void connectFailureLogsWarning(CapturedOutput output) throws Exception {
this.requestFactory.willRespond(new ConnectException());
TunnelChannel tunnel = openTunnel(true);
assertThat(tunnel.isOpen()).isFalse();
assertThat(capturedOutput).contains("Failed to connect to remote application at http://localhost:12345");
assertThat(output).contains("Failed to connect to remote application at http://localhost:12345");
}
private void write(TunnelChannel channel, String string) throws IOException {