@Test
public void buildShouldBuildAProxyWithCRestInvocationHandler() throws Exception, IllegalAccessException {

    TestInterface expected = mock(TestInterface.class);
    ArgumentCaptor<ObjectMethodsAwareInvocationHandler> objectMethodsAwareInvocationHandlerCaptor = ArgumentCaptor.forClass(ObjectMethodsAwareInvocationHandler.class);
    when(proxyFactory.createProxy(eq(TestInterface.class.getClassLoader()), objectMethodsAwareInvocationHandlerCaptor.capture(), eq(new Class[]{TestInterface.class}))).thenReturn(expected);
    when(configFactory.newConfig(TestInterface.class)).thenReturn(config);
    TestInterface actual = toTest.build(TestInterface.class);
    assertSame(expected,actual);
    assertEquals("CRestInvocationHandler", objectMethodsAwareInvocationHandlerCaptor.getValue().getClass().getSimpleName());
    assertEquals(config, Classes.getFieldValue(objectMethodsAwareInvocationHandlerCaptor.getValue(), "interfaceConfig"));
}