@Test
public void buildShouldWrapInCRestExceptionWhenFailure() {

    RuntimeException e = new RuntimeException();
    RuntimeException expected = new RuntimeException();
    when(proxyFactory.createProxy(eq(TestInterface.class.getClassLoader()), isA(InvocationHandler.class), eq(new Class[]{TestInterface.class}))).thenThrow(e);
    mockStatic(CRestException.class);
    when(CRestException.handle(e)).thenReturn(expected);
    try {
        toTest.build(TestInterface.class);
        fail();
    } catch (Exception e1) {
        assertSame(expected, e1);
    }
}