### Question:
HighlyAvailableCommitProcessFactory implements CommitProcessFactory { @Override public TransactionCommitProcess create( TransactionAppender appender, StorageEngine storageEngine, Config config ) { if ( config.get( GraphDatabaseSettings.read_only ) ) { return new ReadOnlyTransactionCommitProcess(); } return (TransactionCommitProcess) newProxyInstance( TransactionCommitProcess.class.getClassLoader(), new Class[]{TransactionCommitProcess.class}, commitProcessDelegate ); } HighlyAvailableCommitProcessFactory( DelegateInvocationHandler<TransactionCommitProcess> commitProcessDelegate ); @Override TransactionCommitProcess create( TransactionAppender appender, StorageEngine storageEngine,
            Config config );  }### Answer:
@Test public void createReadOnlyCommitProcess() { HighlyAvailableCommitProcessFactory factory = new HighlyAvailableCommitProcessFactory( new DelegateInvocationHandler<>( TransactionCommitProcess.class ) ); Config config = Config.defaults( GraphDatabaseSettings.read_only, "true" ); TransactionCommitProcess commitProcess = factory.create( mock( TransactionAppender.class ), mock( StorageEngine.class ), config ); assertThat( commitProcess, instanceOf( ReadOnlyTransactionCommitProcess.class ) ); }
@Test public void createRegularCommitProcess() { HighlyAvailableCommitProcessFactory factory = new HighlyAvailableCommitProcessFactory( new DelegateInvocationHandler<>( TransactionCommitProcess.class ) ); TransactionCommitProcess commitProcess = factory.create( mock( TransactionAppender.class ), mock( StorageEngine.class ), Config.defaults() ); assertThat( commitProcess, not( instanceOf( ReadOnlyTransactionCommitProcess.class ) ) ); assertThat( Proxy.getInvocationHandler( commitProcess ), instanceOf( DelegateInvocationHandler.class ) ); }