@Test
public void newProxyInstance() throws Exception {

  InvocationHandler mockInvocationHandler =
      new InvocationHandler() {
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
          assertThat(method.getName()).isEqualTo("vendorSpecificMethod");
          return method.invoke(mockStatement, args);
        }
      };
  Object proxy = Proxies.newProxyInstance(mockStatement, mockInvocationHandler);
  assertThat(proxy instanceof VendorSpecificPreparedStatement).isTrue();
  ((VendorSpecificPreparedStatement) proxy).vendorSpecificMethod();
  verify(mockStatement).vendorSpecificMethod();
}