diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/StartupInfoLoggerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/StartupInfoLoggerTests.java index 668b61a3f3..7563cfd43e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/StartupInfoLoggerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/StartupInfoLoggerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -16,10 +16,14 @@ package org.springframework.boot; +import java.net.InetAddress; +import java.net.UnknownHostException; + import org.apache.commons.logging.Log; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; +import org.springframework.boot.system.ApplicationPid; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; @@ -38,12 +42,15 @@ class StartupInfoLoggerTests { private final Log log = mock(Log.class); @Test - void sourceClassIncluded() { + void startingFormat() throws UnknownHostException { given(this.log.isInfoEnabled()).willReturn(true); new StartupInfoLogger(getClass()).logStarting(this.log); ArgumentCaptor captor = ArgumentCaptor.forClass(Object.class); verify(this.log).info(captor.capture()); - assertThat(captor.getValue().toString()).startsWith("Starting " + getClass().getSimpleName()); + assertThat(captor.getValue().toString()).matches("Starting " + getClass().getSimpleName() + " using Java " + + System.getProperty("java.version") + " on " + InetAddress.getLocalHost().getHostName() + " with PID " + + new ApplicationPid() + " \\(started by " + System.getProperty("user.name") + " in " + + System.getProperty("user.dir") + "\\)"); } @Test