@Test public void testDeleteBankAccountNullBankAccountId() { BankAccountService bankService = new BankAccountService(); try { bankService.delete(null, null); 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 { bankService.delete("customerId", null); 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 { bankService.delete("customerId", ""); 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 { bankService.delete("", ""); 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 BankAccount delete(String customerId, String bankaccountId) throws BaseException { logger.debug("Enter BankAccountService::delete"); if (StringUtils.isBlank(customerId)) { logger.error("IllegalArgumentException {}", customerId); throw new IllegalArgumentException("customerId cannot be empty or null"); } if (StringUtils.isBlank(bankaccountId)) { logger.error("IllegalArgumentException {}", bankaccountId); throw new IllegalArgumentException("bankaccountId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl().replaceAll("payments", "customers") + "{id}/bank-accounts/{bankaccount_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", customerId.toString()) .replaceAll("\\{" + "bankaccount_id" + "\\}", bankaccountId); logger.info("apiUrl - " + apiUrl); Request request = new Request.RequestBuilder(MethodType.DELETE, apiUrl).context(requestContext).build(); Response response = sendRequest(request); BankAccount bankAccountResponse = new BankAccount(); prepareResponse(request, response, bankAccountResponse); return bankAccountResponse; }
BankAccountService extends ServiceBase { public BankAccount delete(String customerId, String bankaccountId) throws BaseException { logger.debug("Enter BankAccountService::delete"); if (StringUtils.isBlank(customerId)) { logger.error("IllegalArgumentException {}", customerId); throw new IllegalArgumentException("customerId cannot be empty or null"); } if (StringUtils.isBlank(bankaccountId)) { logger.error("IllegalArgumentException {}", bankaccountId); throw new IllegalArgumentException("bankaccountId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl().replaceAll("payments", "customers") + "{id}/bank-accounts/{bankaccount_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", customerId.toString()) .replaceAll("\\{" + "bankaccount_id" + "\\}", bankaccountId); logger.info("apiUrl - " + apiUrl); Request request = new Request.RequestBuilder(MethodType.DELETE, apiUrl).context(requestContext).build(); Response response = sendRequest(request); BankAccount bankAccountResponse = new BankAccount(); prepareResponse(request, response, bankAccountResponse); return bankAccountResponse; } }
BankAccountService extends ServiceBase { public BankAccount delete(String customerId, String bankaccountId) throws BaseException { logger.debug("Enter BankAccountService::delete"); if (StringUtils.isBlank(customerId)) { logger.error("IllegalArgumentException {}", customerId); throw new IllegalArgumentException("customerId cannot be empty or null"); } if (StringUtils.isBlank(bankaccountId)) { logger.error("IllegalArgumentException {}", bankaccountId); throw new IllegalArgumentException("bankaccountId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl().replaceAll("payments", "customers") + "{id}/bank-accounts/{bankaccount_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", customerId.toString()) .replaceAll("\\{" + "bankaccount_id" + "\\}", bankaccountId); logger.info("apiUrl - " + apiUrl); Request request = new Request.RequestBuilder(MethodType.DELETE, apiUrl).context(requestContext).build(); Response response = sendRequest(request); BankAccount bankAccountResponse = new BankAccount(); prepareResponse(request, response, bankAccountResponse); return bankAccountResponse; } BankAccountService(RequestContext requestContext); protected  BankAccountService(); }
BankAccountService extends ServiceBase { public BankAccount delete(String customerId, String bankaccountId) throws BaseException { logger.debug("Enter BankAccountService::delete"); if (StringUtils.isBlank(customerId)) { logger.error("IllegalArgumentException {}", customerId); throw new IllegalArgumentException("customerId cannot be empty or null"); } if (StringUtils.isBlank(bankaccountId)) { logger.error("IllegalArgumentException {}", bankaccountId); throw new IllegalArgumentException("bankaccountId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl().replaceAll("payments", "customers") + "{id}/bank-accounts/{bankaccount_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", customerId.toString()) .replaceAll("\\{" + "bankaccount_id" + "\\}", bankaccountId); logger.info("apiUrl - " + apiUrl); Request request = new Request.RequestBuilder(MethodType.DELETE, apiUrl).context(requestContext).build(); Response response = sendRequest(request); BankAccount bankAccountResponse = new BankAccount(); prepareResponse(request, response, bankAccountResponse); return bankAccountResponse; } BankAccountService(RequestContext requestContext); protected  BankAccountService(); RequestContext getRequestContext(); void setRequestContext(RequestContext requestContext); BankAccount create(BankAccount bankAccount, String customerId); BankAccount createFromToken(Token token, String customerId); BankAccount delete(String customerId, String bankaccountId); BankAccount getBankAccount(String customerId, String bankaccountId); @SuppressWarnings("unchecked") QueryResponse getAllBankAccounts(String customerId); @SuppressWarnings("unchecked") QueryResponse getAllBankAccounts(String customerId, int count); }
BankAccountService extends ServiceBase { public BankAccount delete(String customerId, String bankaccountId) throws BaseException { logger.debug("Enter BankAccountService::delete"); if (StringUtils.isBlank(customerId)) { logger.error("IllegalArgumentException {}", customerId); throw new IllegalArgumentException("customerId cannot be empty or null"); } if (StringUtils.isBlank(bankaccountId)) { logger.error("IllegalArgumentException {}", bankaccountId); throw new IllegalArgumentException("bankaccountId cannot be empty or null"); } String apiUrl = requestContext.getBaseUrl().replaceAll("payments", "customers") + "{id}/bank-accounts/{bankaccount_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "id" + "\\}", customerId.toString()) .replaceAll("\\{" + "bankaccount_id" + "\\}", bankaccountId); logger.info("apiUrl - " + apiUrl); Request request = new Request.RequestBuilder(MethodType.DELETE, apiUrl).context(requestContext).build(); Response response = sendRequest(request); BankAccount bankAccountResponse = new BankAccount(); prepareResponse(request, response, bankAccountResponse); return bankAccountResponse; } BankAccountService(RequestContext requestContext); protected  BankAccountService(); RequestContext getRequestContext(); void setRequestContext(RequestContext requestContext); BankAccount create(BankAccount bankAccount, String customerId); BankAccount createFromToken(Token token, String customerId); BankAccount delete(String customerId, String bankaccountId); BankAccount getBankAccount(String customerId, String bankaccountId); @SuppressWarnings("unchecked") QueryResponse getAllBankAccounts(String customerId); @SuppressWarnings("unchecked") QueryResponse getAllBankAccounts(String customerId, int count);  }