// @Test
  public void testCountByMemberCenterDate() throws Exception {
    initTestContext("../test-data/collections/test-collections.csv");

    Membership membership = null;
    for (final Membership m : DAIRY.getMemberships()) {
      if (m.getMemberNumber().equals("1975") || m.getMemberNumber().equals("01975")) {
        membership = m;
        break;
      }
    }

    final DairyLocation centerBad = DairyFactory.eINSTANCE.createDairyLocation();
    centerBad.setName("test");
    centerBad.setLocation(DairyUtil.createLocation(null, null, null));
    centerBad.setCode("RXXX");
    DAIRY.getBranchLocations().add(centerBad);
    repo.save(DAIRY);

    final DairyLocation centerGood = centers.get("R012");
    final Date date = DateFormat.getDateInstance().parse("June 20, 2010");

    assertEquals(1, repo.countByMemberCenterDate(membership, centerGood, date));
    assertEquals(0, repo.countByMemberCenterDate(membership, centerBad, date));
    // assertEquals(0, repo.countByMemberCenterDate(null, null, null));
  }
  protected Membership createMember(String accountNo) {
    final Farmer farmer = DairyUtil.createFarmer(accountNo, "", "", "", (Farm) null);
    farmer.setNickName(accountNo);

    final Membership member = DairyUtil.createMembership(new Date(), new Date(), farmer);
    member.setMemberNumber(accountNo);
    member.setStatus(MembershipStatus.ACTIVE);

    DAIRY.getMemberships().add(member);
    repo.save(DAIRY);

    return member;
  }
  // @Test
  public void testGetSumOfPayableDeliveries() throws Exception {
    initTestContext("../test-data/collections/test-collections.csv");
    // ICollectionJournalLineRepository repo = new
    // MilkCollectionJournalLineRepository();

    Membership member = null;
    for (final Membership m : DAIRY.getMemberships()) {
      if (m.getMemberNumber().equals("1975") || m.getMemberNumber().equals("01975")) {
        member = m;
        break;
      }
    }
    assertNotNull(member);

    assertEquals(new BigDecimal("88.6"), repo.getSumOfPayableDeliveries(member, 6, 2010));
  }
  // @Test
  public void testGetPayableDeliveriesForMember() throws Exception {
    initTestContext("../test-data/collections/test-collections.csv");
    // ICollectionJournalLineRepository repo = new
    // MilkCollectionJournalLineRepository();

    Membership member = null;
    for (final Membership m : DAIRY.getMemberships()) {
      if (m.getMemberNumber().equals("1975") || m.getMemberNumber().equals("01975")) {
        member = m;
        break;
      }
    }
    assertNotNull(member);

    List<CollectionJournalLine> collections;

    collections = repo.getPayableDeliveriesForMember(member, 6, 2010);
    assertEquals(6, collections.size());
    collections = repo.getPayableDeliveriesForMember(member, 7, 2010);
    assertEquals(0, collections.size());
    collections = repo.getPayableDeliveriesForMember(member, 8, 2010);
    assertEquals(17, collections.size());
  }