@Test
public void testWriteFileNamesToResponse() throws IOException {

    //GIVEN
    String expectedJson = "{\"test\":\"test\"}";
    given(fileListProperties.getMaximumCountOfMessages()).willReturn(10);
    given(path.toFile()).willReturn(file);
    given(messageFileJsonBuilder.buildMessageFileListJson(file, 10)).willReturn(expectedJson);
    //WHEN
    underTest.writeFileNamesToResponse(response, path);
    //THEN
    verify(response).setContentType(APPLICATION_JSON);
    verify(messageFileJsonBuilder).buildMessageFileListJson(file, 10);
    verify(printWriter).write(expectedJson);
    verify(printWriter).flush();
}