Ensure that logfile endpoint documentation has some log entries to use

Closes gh-5848
This commit is contained in:
Andy Wilkinson 2016-05-03 15:13:22 +01:00
parent 6f4ec4e741
commit f8a4459aa1
2 changed files with 8 additions and 2 deletions

View File

@ -21,7 +21,7 @@
<!-- Provided --> <!-- Provided -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -28,6 +28,7 @@ import java.util.Map;
import groovy.text.Template; import groovy.text.Template;
import groovy.text.TemplateEngine; import groovy.text.TemplateEngine;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -60,7 +61,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
"endpoints.health.sensitive=true", "endpoints.actuator.enabled=false" }) "endpoints.health.sensitive=true", "endpoints.actuator.enabled=false" })
@DirtiesContext @DirtiesContext
@AutoConfigureRestDocs(EndpointDocumentation.RESTDOCS_OUTPUT_DIR) @AutoConfigureRestDocs(EndpointDocumentation.RESTDOCS_OUTPUT_DIR)
@AutoConfigureMockMvc @AutoConfigureMockMvc(alwaysPrint = false)
public class EndpointDocumentation { public class EndpointDocumentation {
static final String RESTDOCS_OUTPUT_DIR = "target/generated-snippets"; static final String RESTDOCS_OUTPUT_DIR = "target/generated-snippets";
@ -74,6 +75,11 @@ public class EndpointDocumentation {
@Autowired @Autowired
private MockMvc mockMvc; private MockMvc mockMvc;
@BeforeClass
public static void clearLog() {
new File("target/logs/spring.log").delete();
}
@Test @Test
public void logfile() throws Exception { public void logfile() throws Exception {
this.mockMvc.perform(get("/logfile").accept(MediaType.TEXT_PLAIN)) this.mockMvc.perform(get("/logfile").accept(MediaType.TEXT_PLAIN))