// Case 2 when multiple bankIDs are returned by the dao
  public void testSetBankID2() throws Exception {

    List<String> bankIds = new ArrayList<String>();
    bankIds.add("7865564");
    bankIds.add("7865564");
    mockdao.bankIDs = bankIds;

    DonorBankCplxType bank = new DonorBankCplxType();
    bank.setBankAccNo("78908766");
    bank.setBankAccName("TesterFirst");
    bank.setBankSort("7691382193");
    bank.setBankName("Any Bank");
    bank.setBankSort("an-ys-or");
    bank.setBranchName("Buckingham palace");

    GOSHCC goshcc = new GOSHCC();
    final DonorCplxType donorCplxType = new DonorCplxType();
    donorCplxType.setFirstName("TesterFirst");
    donorCplxType.setLastName("TesterLast");
    donorCplxType.setPostCode("CR0 6RT");

    DonationDetails donationDetails = new DonationDetails();

    DirectDebitDonationCplxType directDebitDonationCplxType = new DirectDebitDonationCplxType();
    directDebitDonationCplxType.setDonorBankCplxType(bank);
    donationDetails.setDirectDebitDonationCplxType(directDebitDonationCplxType);
    donorCplxType.setDonationDetails(donationDetails);
    goshcc.getDonorCplxType().add(donorCplxType);

    header.put(MessageHeaderName.FILE_TYPE.getName(), FileType.DD_TYPE);
    final GenericMessage<GOSHCC> message = new GenericMessage<GOSHCC>(goshcc, header);
    Message<GOSHCC> transformedMessage = classToTest.transform(message);

    ArrayList<String> errorArray =
        (ArrayList<String>)
            transformedMessage.getHeaders().get(MessageHeaderName.ERROR_HEADER.getName());

    assertNotNull("1 error expected", errorArray);
    assertEquals("No. of errors don't match the expected", 1, errorArray.size());

    ArrayList<String> infoArray =
        (ArrayList<String>)
            transformedMessage.getHeaders().get(MessageHeaderName.INFO_HEADER.getName());

    assertNotNull("1 info expected, none found", infoArray);

    String infoMsg =
        "Multiple banks found for the following bank details: an-ys-or, Any Bank and Buckingham palace;";
    assertEquals("Info messages dont match", infoMsg, infoArray.get(0));
  }
  // Case 1 when bankID is returned by the dao
  public void testSetBankID() throws Exception {

    List<String> bankIds = new ArrayList<String>();
    bankIds.add("7865564");
    mockdao.bankIDs = bankIds;

    DonorBankCplxType bank = new DonorBankCplxType();
    bank.setBankAccNo("78908766");
    bank.setBankAccName("TesterFirst");
    bank.setBankSort("7691382193");
    bank.setBankName("Any Bank");
    bank.setBankSort("an-ys-or");
    bank.setBranchName("Buckingham palace");

    GOSHCC goshcc = new GOSHCC();
    final DonorCplxType donorCplxType = new DonorCplxType();
    donorCplxType.setFirstName("TesterFirst");
    donorCplxType.setLastName("TesterLast");
    donorCplxType.setPostCode("CR0 6RT");

    DonationDetails donationDetails = new DonationDetails();

    DirectDebitDonationCplxType directDebitDonationCplxType = new DirectDebitDonationCplxType();
    directDebitDonationCplxType.setDonorBankCplxType(bank);
    donationDetails.setDirectDebitDonationCplxType(directDebitDonationCplxType);
    donorCplxType.setDonationDetails(donationDetails);
    goshcc.getDonorCplxType().add(donorCplxType);

    header.put(MessageHeaderName.FILE_TYPE.getName(), FileType.DD_TYPE);
    final GenericMessage<GOSHCC> message = new GenericMessage<GOSHCC>(goshcc, header);
    Message<GOSHCC> transformedMessage = classToTest.transform(message);

    ArrayList<String> errorArray =
        (ArrayList<String>)
            transformedMessage.getHeaders().get(MessageHeaderName.ERROR_HEADER.getName());

    assertNull("No errors expected", errorArray);

    BigInteger bankID =
        transformedMessage
            .getPayload()
            .getDonorCplxType()
            .get(0)
            .getDonationDetails()
            .getDirectDebitDonationCplxType()
            .getDonorBankCplxType()
            .getBankID();

    assertEquals("bankIDs dont match", BigInteger.valueOf(7865564), bankID);
  }