@Test
public void should_return_error_response_when_error_occur_on_generation() throws Exception {

    when(pageRepository.get(page.getId())).thenReturn(page);
    when(generator.generateHtml("/runtime/", page)).thenThrow(new GenerationException("error", new Exception()));
    ResponseEntity<String> response = previewer.render(page.getId(), pageRepository, request);
    assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
    assertThat(response.getBody()).isEqualTo("Error during page generation");
}