// Path: src/main/java/org/gm4java/engine/GMServiceException.java
// public class GMServiceException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Constructs a new exception with given message.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      */
//     public GMServiceException(String message) {
//         super(message);
//     }
// 
//     /**
//      * Constructs a new exception with given message and cause.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      * @param cause
//      *            the cause of the error.
//      */
//     public GMServiceException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Writer;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.mockito.Mockito.*;
import edu.umd.cs.findbugs.annotations.SuppressWarnings;
import org.gm4java.engine.GMServiceException;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
        sut = new GMConnectionPool(config);
        sut.setProcessFactoryBuilder(builder);
    }

    @After
    public void teardown() throws Exception {
        sut.close();
    }

    @Test
    @SuppressWarnings("NP_NONNULL_PARAM_VIOLATION")
    public void constructor_chokes_onNullConfig() throws Exception {
        exception.expect(NullPointerException.class);
        exception.expectMessage("config");

        new GMConnectionPool(null);
    }

    @Test
    public void borrowObject_chokes_whenCreateReaderWriterFails() throws Exception {
        when(factory.getProcess()).thenThrow(new IOException(READER_WRITER_PROCESS_FAILURE));

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

        sut.borrowObject();
    }

    @Test
    public void borrowObject_propagatesRuntimeException() throws Exception {
// Path: src/main/java/org/gm4java/engine/GMServiceException.java
// public class GMServiceException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Constructs a new exception with given message.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      */
//     public GMServiceException(String message) {
//         super(message);
//     }
// 
//     /**
//      * Constructs a new exception with given message and cause.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      * @param cause
//      *            the cause of the error.
//      */
//     public GMServiceException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


// Path: src/test/java/org/gm4java/engine/support/GMConnectionPoolTest.java
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Writer;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.mockito.Mockito.*;
import edu.umd.cs.findbugs.annotations.SuppressWarnings;
import org.gm4java.engine.GMServiceException;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

        sut = new GMConnectionPool(config);
        sut.setProcessFactoryBuilder(builder);
    }

    @After
    public void teardown() throws Exception {
        sut.close();
    }

    @Test
    @SuppressWarnings("NP_NONNULL_PARAM_VIOLATION")
    public void constructor_chokes_onNullConfig() throws Exception {
        exception.expect(NullPointerException.class);
        exception.expectMessage("config");

        new GMConnectionPool(null);
    }

    @Test
    public void borrowObject_chokes_whenCreateReaderWriterFails() throws Exception {
        when(factory.getProcess()).thenThrow(new IOException(READER_WRITER_PROCESS_FAILURE));

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

        sut.borrowObject();
    }

    @Test
    public void borrowObject_propagatesRuntimeException() throws Exception {
        when(factory.getProcess()).thenThrow(new NullPointerException(READER_WRITER_PROCESS_FAILURE));