Prevent run failures in tests from polluting LoggerContext
This commit is contained in:
@@ -16,13 +16,17 @@
|
||||
|
||||
package org.springframework.boot.devtools;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
@@ -38,6 +42,12 @@ public class RemoteUrlPropertyExtractorTests {
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@After
|
||||
public void preventRunFailuresFromPollutingLoggerContext() {
|
||||
((Logger) LoggerFactory.getLogger(RemoteUrlPropertyExtractorTests.class))
|
||||
.getLoggerContext().getTurboFilterList().clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingUrl() throws Exception {
|
||||
this.thrown.expect(IllegalStateException.class);
|
||||
|
||||
Reference in New Issue
Block a user