Fix Windows build failures

See gh-23098
This commit is contained in:
Phillip Webb 2021-04-15 18:31:01 -07:00
parent a48c98b469
commit e1ad2cdab3

View File

@ -96,23 +96,25 @@ class ApplicationAvailabilityBeanTests {
@Test
void stateChangesAreLogged(CapturedOutput output) {
AvailabilityChangeEvent.publish(this.context, LivenessState.CORRECT);
assertThat(output).contains("Application availability state LivenessState changed to CORRECT\n");
assertThat(output)
.contains("Application availability state LivenessState changed to CORRECT" + System.lineSeparator());
AvailabilityChangeEvent.publish(this.context, LivenessState.BROKEN);
assertThat(output).contains("Application availability state LivenessState changed from CORRECT to BROKEN\n");
assertThat(output).contains(
"Application availability state LivenessState changed from CORRECT to BROKEN" + System.lineSeparator());
}
@Test
void stateChangesAreLoggedWithExceptionSource(CapturedOutput output) {
AvailabilityChangeEvent.publish(this.context, new IOException("connection error"), LivenessState.BROKEN);
assertThat(output).contains("Application availability state LivenessState changed to BROKEN: "
+ "java.io.IOException: connection error\n");
+ "java.io.IOException: connection error" + System.lineSeparator());
}
@Test
void stateChangesAreLoggedWithOtherSource(CapturedOutput output) {
AvailabilityChangeEvent.publish(this.context, new CustomEventSource(), LivenessState.BROKEN);
assertThat(output).contains("Application availability state LivenessState changed to BROKEN: "
+ CustomEventSource.class.getName() + "\n");
+ CustomEventSource.class.getName() + System.lineSeparator());
}
enum TestState implements AvailabilityState {