Move back to JUnit 4 until SUREFIRE-1614 has been resolved
See gh-14736 See gh-14737 See gh-14738
This commit is contained in:
@@ -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.
|
||||
@@ -21,13 +21,15 @@ import java.util.Base64;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.extension.OutputCapture;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@@ -41,7 +43,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
* @author Dave Syer
|
||||
* @@author Stephane Nicoll
|
||||
*/
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
public class SampleActuatorLog4J2ApplicationTests {
|
||||
@@ -49,8 +51,8 @@ public class SampleActuatorLog4J2ApplicationTests {
|
||||
private static final Logger logger = LogManager
|
||||
.getLogger(SampleActuatorLog4J2ApplicationTests.class);
|
||||
|
||||
@RegisterExtension
|
||||
OutputCapture output = new OutputCapture();
|
||||
@Rule
|
||||
public final OutputCapture output = new OutputCapture();
|
||||
|
||||
@Autowired
|
||||
private MockMvc mvc;
|
||||
@@ -58,7 +60,7 @@ public class SampleActuatorLog4J2ApplicationTests {
|
||||
@Test
|
||||
public void testLogger() {
|
||||
logger.info("Hello World");
|
||||
Assertions.assertThat(this.output).contains("Hello World");
|
||||
Assertions.assertThat(this.output.toString()).contains("Hello World");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user