@Test
public void calculateContentDisposition() throws Exception {

  final IAsyncReportState state1 =
    new AsyncReportState( UUID.randomUUID(), "/somepath/anotherlevel/file.prpt", AsyncExecutionStatus.FINISHED, 0, 0,
      0, 0, 0, 0, "", MimeHelper.MIMETYPE_CSV, "", false );
  final Response.ResponseBuilder builder1 = mock( Response.ResponseBuilder.class );
  JobManager.calculateContentDisposition( builder1, state1 );
  ArgumentCaptor<String> argument = ArgumentCaptor.forClass( String.class );
  verify( builder1, times( 1 ) ).header( eq( "Content-Description" ), argument.capture() );
  assertTrue( argument.getValue().contains( "file.prpt" ) );
  verify( builder1, times( 1 ) ).header( eq( "Content-Disposition" ), argument.capture() );
  assertTrue( argument.getValue().contains( "attachment; filename*=UTF-8''file.csv" ) );
  final IAsyncReportState state2 =
    new AsyncReportState( UUID.randomUUID(), "/somepath/anotherlevel/file.prpt", AsyncExecutionStatus.FINISHED, 0, 0,
      0, 0, 0, 0, "", MimeHelper.MIMETYPE_PDF, "", false );
  final Response.ResponseBuilder builder2 = mock( Response.ResponseBuilder.class );
  JobManager.calculateContentDisposition( builder2, state2 );
  argument = ArgumentCaptor.forClass( String.class );
  verify( builder2, times( 1 ) ).header( eq( "Content-Description" ), argument.capture() );
  assertTrue( argument.getValue().contains( "file.prpt" ) );
  verify( builder2, times( 1 ) ).header( eq( "Content-Disposition" ), argument.capture() );
  assertTrue( argument.getValue().contains( "inline; filename*=UTF-8''file.pdf" ) );
}