@Test public void testRefundNullECheckId() { ECheckService eCheckService = new ECheckService(); Refund refund = new Refund(); try { eCheckService.refund(null, refund); Assert.fail("Expected IllegalArgumentException thrown"); } catch (IllegalArgumentException e) { Assert.assertTrue(true, "Expected IllegalArgumentException was thrown"); } catch (BaseException e) { Assert.fail("Unexpected BaseException thrown " + e.getMessage()); } try { eCheckService.refund("", refund); Assert.fail("Expected IllegalArgumentException thrown"); } catch (IllegalArgumentException e) { Assert.assertTrue(true, "Expected IllegalArgumentException was thrown"); } catch (BaseException e) { Assert.fail("Unexpected BaseException thrown " + e.getMessage()); } }
public Refund refund(String eCheckId, Refund refund) throws BaseException { logger.debug("Enter ECheckService::refund"); if (StringUtils.isBlank(eCheckId)) { logger.error("IllegalArgumentException {}", eCheckId); throw new IllegalArgumentException("eCheckId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl() + "echecks/{id}/refunds".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", eCheckId.toString()); logger.info("apiUrl - " + apiUrl); TypeReference<Refund> typeReference = new TypeReference<Refund>() { }; Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).requestObject(refund) .typeReference(typeReference).context(requestContext).build(); Response response = sendRequest(request); Refund refundResponse = (Refund) response.getResponseObject(); prepareResponse(request, response, refundResponse); return refundResponse; }
ECheckService extends ServiceBase { public Refund refund(String eCheckId, Refund refund) throws BaseException { logger.debug("Enter ECheckService::refund"); if (StringUtils.isBlank(eCheckId)) { logger.error("IllegalArgumentException {}", eCheckId); throw new IllegalArgumentException("eCheckId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl() + "echecks/{id}/refunds".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", eCheckId.toString()); logger.info("apiUrl - " + apiUrl); TypeReference<Refund> typeReference = new TypeReference<Refund>() { }; Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).requestObject(refund) .typeReference(typeReference).context(requestContext).build(); Response response = sendRequest(request); Refund refundResponse = (Refund) response.getResponseObject(); prepareResponse(request, response, refundResponse); return refundResponse; } }
ECheckService extends ServiceBase { public Refund refund(String eCheckId, Refund refund) throws BaseException { logger.debug("Enter ECheckService::refund"); if (StringUtils.isBlank(eCheckId)) { logger.error("IllegalArgumentException {}", eCheckId); throw new IllegalArgumentException("eCheckId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl() + "echecks/{id}/refunds".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", eCheckId.toString()); logger.info("apiUrl - " + apiUrl); TypeReference<Refund> typeReference = new TypeReference<Refund>() { }; Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).requestObject(refund) .typeReference(typeReference).context(requestContext).build(); Response response = sendRequest(request); Refund refundResponse = (Refund) response.getResponseObject(); prepareResponse(request, response, refundResponse); return refundResponse; } ECheckService(RequestContext requestContext); protected  ECheckService(); }
ECheckService extends ServiceBase { public Refund refund(String eCheckId, Refund refund) throws BaseException { logger.debug("Enter ECheckService::refund"); if (StringUtils.isBlank(eCheckId)) { logger.error("IllegalArgumentException {}", eCheckId); throw new IllegalArgumentException("eCheckId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl() + "echecks/{id}/refunds".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", eCheckId.toString()); logger.info("apiUrl - " + apiUrl); TypeReference<Refund> typeReference = new TypeReference<Refund>() { }; Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).requestObject(refund) .typeReference(typeReference).context(requestContext).build(); Response response = sendRequest(request); Refund refundResponse = (Refund) response.getResponseObject(); prepareResponse(request, response, refundResponse); return refundResponse; } ECheckService(RequestContext requestContext); protected  ECheckService(); RequestContext getRequestContext(); void setRequestContext(RequestContext requestContext); ECheck create(ECheck eCheck); ECheck retrieve(String eCheckId); Refund refund(String eCheckId, Refund refund); Refund getRefund(String eCheckId, String refundId); }
ECheckService extends ServiceBase { public Refund refund(String eCheckId, Refund refund) throws BaseException { logger.debug("Enter ECheckService::refund"); if (StringUtils.isBlank(eCheckId)) { logger.error("IllegalArgumentException {}", eCheckId); throw new IllegalArgumentException("eCheckId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl() + "echecks/{id}/refunds".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", eCheckId.toString()); logger.info("apiUrl - " + apiUrl); TypeReference<Refund> typeReference = new TypeReference<Refund>() { }; Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).requestObject(refund) .typeReference(typeReference).context(requestContext).build(); Response response = sendRequest(request); Refund refundResponse = (Refund) response.getResponseObject(); prepareResponse(request, response, refundResponse); return refundResponse; } ECheckService(RequestContext requestContext); protected  ECheckService(); RequestContext getRequestContext(); void setRequestContext(RequestContext requestContext); ECheck create(ECheck eCheck); ECheck retrieve(String eCheckId); Refund refund(String eCheckId, Refund refund); Refund getRefund(String eCheckId, String refundId);  }