@Test public void testHandleCallbackMessageCallsOnErrorWithThrowableArg() throws Exception { GatewayCallback callback = mock(GatewayCallback.class); Throwable arg = new Exception("Some exception"); gateway.handleCallbackMessage(callback, arg); verify(callback).onError(arg); }
@SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; }
Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } }
Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); }
Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, GatewayMap payload, GatewayCallback callback); Single<GatewayMap> updateSession(String sessionId, String apiVersion, GatewayMap payload); static void start3DSecureActivity(Activity activity, String html); static void start3DSecureActivity(Activity activity, String html, String title); static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback); static void requestGooglePayData(PaymentsClient paymentsClient, PaymentDataRequest request, Activity activity); static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback); }
Gateway { @SuppressWarnings("unchecked") boolean handleCallbackMessage(GatewayCallback callback, Object arg) { if (callback != null) { if (arg instanceof Throwable) { callback.onError((Throwable) arg); } else { callback.onSuccess((GatewayMap) arg); } } return true; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, GatewayMap payload, GatewayCallback callback); Single<GatewayMap> updateSession(String sessionId, String apiVersion, GatewayMap payload); static void start3DSecureActivity(Activity activity, String html); static void start3DSecureActivity(Activity activity, String html, String title); static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback); static void requestGooglePayData(PaymentsClient paymentsClient, PaymentDataRequest request, Activity activity); static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback);  }