@Test
void export() throws IOException {

    // arrange
    String msg = "dummy string";
    when(demoService.exportDataSet()).thenReturn(msg);
    // act
    ResponseEntity<Resource> responseEntity = controller.exportDataSet();
    // assert
    assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
    HttpHeaders headers = responseEntity.getHeaders();
    // String.length() works here because the message is ASCII
    assertThat(headers.getContentLength()).isEqualTo(msg.length());
    assertThat(headers.getContentType()).isNotNull();
    assertThat(headers.getContentType().toString()).isEqualToIgnoringWhitespace("text/x-yaml;charset=UTF-8");
    assertThat(headers.getContentDisposition()).isNotNull();
    String contentDisposition = headers.getContentDisposition().toString();
    assertThat(contentDisposition)
            .startsWith("attachment;")
            .containsPattern("; *filename=\".*\\.yaml\"");
}