Ignore existing output when asserting captured log output
Closes gh-12734
This commit is contained in:
parent
ac88a60071
commit
c4923d6273
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -201,8 +201,10 @@ public class LoggingApplicationListenerTests {
|
|||
this.initializer.initialize(this.context.getEnvironment(),
|
||||
this.context.getClassLoader());
|
||||
Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class);
|
||||
String existingOutput = this.outputCapture.toString();
|
||||
logger.info("Hello world");
|
||||
String output = this.outputCapture.toString().trim();
|
||||
String output = this.outputCapture.toString().substring(existingOutput.length())
|
||||
.trim();
|
||||
assertThat(output).startsWith("target/foo.log");
|
||||
}
|
||||
|
||||
|
|
@ -226,8 +228,10 @@ public class LoggingApplicationListenerTests {
|
|||
this.initializer.initialize(this.context.getEnvironment(),
|
||||
this.context.getClassLoader());
|
||||
Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class);
|
||||
String existingOutput = this.outputCapture.toString();
|
||||
logger.info("Hello world");
|
||||
String output = this.outputCapture.toString().trim();
|
||||
String output = this.outputCapture.toString().substring(existingOutput.length())
|
||||
.trim();
|
||||
assertThat(output).startsWith("target/foo/spring.log");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue