@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); } }
@SuppressWarnings("unchecked") public <T> T build(Class<T> interfaze) throws CRestException { try { InterfaceConfig interfaceConfig = configFactory.newConfig(interfaze); return (T) proxyFactory.createProxy(interfaze.getClassLoader(), new CRestInvocationHandler(interfaceConfig), new Class[]{interfaze}); } catch (Exception e) { throw CRestException.handle(e); } }
DefaultCRest extends CRest { @SuppressWarnings("unchecked") public <T> T build(Class<T> interfaze) throws CRestException { try { InterfaceConfig interfaceConfig = configFactory.newConfig(interfaze); return (T) proxyFactory.createProxy(interfaze.getClassLoader(), new CRestInvocationHandler(interfaceConfig), new Class[]{interfaze}); } catch (Exception e) { throw CRestException.handle(e); } } }
DefaultCRest extends CRest { @SuppressWarnings("unchecked") public <T> T build(Class<T> interfaze) throws CRestException { try { InterfaceConfig interfaceConfig = configFactory.newConfig(interfaze); return (T) proxyFactory.createProxy(interfaze.getClassLoader(), new CRestInvocationHandler(interfaceConfig), new Class[]{interfaze}); } catch (Exception e) { throw CRestException.handle(e); } } DefaultCRest(ProxyFactory proxyFactory, RequestExecutor requestExecutor, RequestBuilderFactory requestBuilderFactory, InterfaceConfigFactory configFactory); }
DefaultCRest extends CRest { @SuppressWarnings("unchecked") public <T> T build(Class<T> interfaze) throws CRestException { try { InterfaceConfig interfaceConfig = configFactory.newConfig(interfaze); return (T) proxyFactory.createProxy(interfaze.getClassLoader(), new CRestInvocationHandler(interfaceConfig), new Class[]{interfaze}); } catch (Exception e) { throw CRestException.handle(e); } } DefaultCRest(ProxyFactory proxyFactory, RequestExecutor requestExecutor, RequestBuilderFactory requestBuilderFactory, InterfaceConfigFactory configFactory); @SuppressWarnings("unchecked") T build(Class<T> interfaze); }
DefaultCRest extends CRest { @SuppressWarnings("unchecked") public <T> T build(Class<T> interfaze) throws CRestException { try { InterfaceConfig interfaceConfig = configFactory.newConfig(interfaze); return (T) proxyFactory.createProxy(interfaze.getClassLoader(), new CRestInvocationHandler(interfaceConfig), new Class[]{interfaze}); } catch (Exception e) { throw CRestException.handle(e); } } DefaultCRest(ProxyFactory proxyFactory, RequestExecutor requestExecutor, RequestBuilderFactory requestBuilderFactory, InterfaceConfigFactory configFactory); @SuppressWarnings("unchecked") T build(Class<T> interfaze);  }