11/*
2- * Copyright 2012-2019 the original author or authors.
2+ * Copyright 2012-2020 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616
1717package org .springframework .boot ;
1818
19+ import java .net .InetAddress ;
20+ import java .net .UnknownHostException ;
21+
1922import org .apache .commons .logging .Log ;
2023import org .junit .jupiter .api .Test ;
2124import org .mockito .ArgumentCaptor ;
2225
26+ import org .springframework .boot .system .ApplicationPid ;
2327import org .springframework .util .StopWatch ;
2428
2529import static org .assertj .core .api .Assertions .assertThat ;
@@ -38,12 +42,15 @@ class StartupInfoLoggerTests {
3842 private final Log log = mock (Log .class );
3943
4044 @ Test
41- void sourceClassIncluded () {
45+ void startingFormat () throws UnknownHostException {
4246 given (this .log .isInfoEnabled ()).willReturn (true );
4347 new StartupInfoLogger (getClass ()).logStarting (this .log );
4448 ArgumentCaptor <Object > captor = ArgumentCaptor .forClass (Object .class );
4549 verify (this .log ).info (captor .capture ());
46- assertThat (captor .getValue ().toString ()).startsWith ("Starting " + getClass ().getSimpleName ());
50+ assertThat (captor .getValue ().toString ()).matches ("Starting " + getClass ().getSimpleName () + " using Java "
51+ + System .getProperty ("java.version" ) + " on " + InetAddress .getLocalHost ().getHostName () + " with PID "
52+ + new ApplicationPid () + " \\ (started by " + System .getProperty ("user.name" ) + " in "
53+ + System .getProperty ("user.dir" ) + "\\ )" );
4754 }
4855
4956 @ Test
0 commit comments