@Test
@WithMockUser(authorities = { "ADMIN" })

public void testDownloadLog()
        throws Exception
{
    String testLogName = "strongbox-test.log";
    Path file = Paths.get(propertiesBooter.getLogsDirectory(), testLogName);
    Files.createFile(file)
         .toFile()
         .deleteOnExit();
    // write some log messages.
    List<String> lines = Arrays.asList("Strongbox", "is", "awesome!");
    Files.write(file, lines, StandardCharsets.UTF_8);
    // Make sure the log file contains something.
    assertThat(file.toFile().length()).isGreaterThan(0);
    String url = getContextBaseUrl() + "/download/" + testLogName;
    ResponseBodyExtractionOptions body = mockMvc.header(HttpHeaders.ACCEPT,
                                                        MediaType.APPLICATION_OCTET_STREAM_VALUE)
                                                .when()
                                                .get(url)
                                                .peek() // Use peek() to print the output
                                                .then()
                                                .statusCode(HttpStatus.OK.value()) // check http status code
                                                .extract()
                                                .body();
    assertThat(body.asByteArray().length).isEqualTo(file.toFile().length());
}