예제 #1
0
  @Test
  public void constructor_chokes_whenCreateReaderWriterFails() throws Exception {
    when(pool.createProcess()).thenThrow(new GMServiceException(READER_WRITER_PROCESS_FAILURE));

    exception.expect(GMServiceException.class);
    exception.expectMessage(READER_WRITER_PROCESS_FAILURE);

    new PooledGMConnection(pool);
  }
예제 #2
0
 @Override
 @Before
 public void setup() throws Exception {
   super.setup();
   final ArgumentCaptor<String> gmPathCaptor = ArgumentCaptor.forClass(String.class);
   when(builder.buildFactory(gmPathCaptor.capture())).thenReturn(factory);
   when(factory.getProcess()).thenReturn(process);
   when(factory.getGMPath())
       .then(
           new Answer<String>() {
             @Override
             public String answer(InvocationOnMock invocation) throws Throwable {
               return gmPathCaptor.getValue();
             }
           });
   pool.setProcessFactoryBuilder(builder);
   when(pool.createProcess()).thenReturn(process);
   sut = new PooledGMConnection(pool);
 }