MondrianFileObject extends DecoratedFileObject { @Override public FileContent getContent() throws FileSystemException { return new DecoratedFileContent( super.getContent() ) { @Override public InputStream getInputStream() throws FileSystemException { return annotator.getInputStream( super.getInputStream(), annotationsFile.getContent().getInputStream() ); } }; } MondrianFileObject(
      final FileObject schemaFile, final FileObject annotationsFile, final MondrianSchemaAnnotator annotator ); @Override FileContent getContent();  }
@Test public void testAppliesAllAnnotators() throws Exception { FileObject schemaFile = FileObjectTestHelper.mockFile( "schemaFile", true ); FileObject annotationsFile = FileObjectTestHelper.mockFile( "annotationsFile", true ); MondrianSchemaAnnotator mondrianSchemaAnnotator = new MondrianSchemaAnnotator() { @Override public InputStream getInputStream( final InputStream schemaInputStream, final InputStream annotationsInputStream ) { try { return new ByteArrayInputStream( ( IOUtils.toString( annotationsInputStream ) + " - " + IOUtils.toString( schemaInputStream ) ).getBytes() ); } catch ( IOException e ) { fail( e.getMessage() ); return null; } } }; MondrianFileObject mondrianFileObject = new MondrianFileObject( schemaFile, annotationsFile, mondrianSchemaAnnotator ); String actual = IOUtils.toString( mondrianFileObject.getContent().getInputStream() ); assertEquals( "annotationsFile - schemaFile", actual ); }