### Question:
ReadOnlyIndexReferenceFactory extends IndexReferenceFactory { @Override IndexReference createIndexReference( IndexIdentifier identifier ) throws IOException, ExplicitIndexNotFoundKernelException { IndexReader reader = DirectoryReader.open( getIndexDirectory( identifier ) ); IndexSearcher indexSearcher = newIndexSearcher( identifier, reader ); return new ReadOnlyIndexReference( identifier, indexSearcher ); } ReadOnlyIndexReferenceFactory( LuceneDataSource.LuceneFilesystemFacade filesystemFacade, File baseStorePath,
            IndexTypeCache typeCache );   }### Answer:
@Test public void createReadOnlyIndexReference() throws Exception { ReadOnlyIndexReferenceFactory indexReferenceFactory = getReadOnlyIndexReferenceFactory(); IndexReference indexReference = indexReferenceFactory.createIndexReference( indexIdentifier ); cleanupRule.add( indexReference ); expectedException.expect( UnsupportedOperationException.class ); indexReference.getWriter(); }