@Test
public void testCreateOutputHandlerForOutputType() throws Exception {

  MockOutputHandlerSelector selector = new MockOutputHandlerSelector();
  selector.setOutputType( "pageable/X-AWT-Graphics;image-type=png" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof PNGOutput );
  roh.setPngAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "pageable/xml" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof XmlPageableOutput );
  roh.setXmlPageAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "table/xml" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof XmlTableOutput );
  roh.setXmlTableAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "pageable/pdf" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof PDFOutput );
  roh.setPdfAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "table/excel;page-mode=flow" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof XLSOutput );
  roh.setXlsAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType(
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;page-mode=flow" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof XLSXOutput );
  roh.setXlsxAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "table/csv;page-mode=stream" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof CSVOutput );
  roh.setCsvAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "table/rtf;page-mode=flow" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof RTFOutput );
  roh.setRtfAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "mime-message/text/html" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof EmailOutput );
  roh.setMailAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "pageable/text" ); //$NON-NLS-1$
  assertTrue( roh.createOutputHandlerForOutputType( selector ) instanceof PlainTextOutput );
  roh.setTextAvailable( false );
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
  selector.setOutputType( "" ); //$NON-NLS-1$
  assertNull( roh.createOutputHandlerForOutputType( selector ) );
}