public void testtotalCountableIncomeTimeline1() {
    final Number caseID = 1111L;
    final List<CaseParticipantRole> caseParticipantRoleList = createCaseParticipantRole();
    final List<SAHouseholdUnitMember> saHouseholdUnitMemberList =
        createSAHouseholdUnitMember(caseParticipantRoleList);

    final SAHouseholdUnitCalculator saHouseholdUnitCalculator =
        SAHouseholdUnitCalculator_Factory.getFactory().newInstance(getSession());
    saHouseholdUnitCalculator.mandatoryMembers().specifyValue(saHouseholdUnitMemberList);
    final List<Interval<Number>> amount = new ArrayList<Interval<Number>>();
    amount.add(new Interval<Number>(null, 0));
    amount.add(new Interval<Number>(Date.fromISO8601("20040601"), 3000));
    final Timeline<Number> amountTimeline = new Timeline<Number>(amount);

    final List<Interval<Number>> amount2 = new ArrayList<Interval<Number>>();
    amount2.add(new Interval<Number>(null, 0));
    amount2.add(new Interval<Number>(Date.fromISO8601("20040601"), 4000));
    final Timeline<Number> amount2Timeline = new Timeline<Number>(amount2);

    final List<Interval<Number>> amount3 = new ArrayList<Interval<Number>>();
    amount3.add(new Interval<Number>(null, 0));
    amount3.add(new Interval<Number>(Date.fromISO8601("20040601"), 0));
    final Timeline<Number> amount3Timeline = new Timeline<Number>(amount3);

    final FamilyOfMissingEligibilityUnitCalculator familyOfMissingObj =
        FamilyOfMissingEligibilityUnitCalculator_Factory.getFactory()
            .newInstance(getSession(), caseID, saHouseholdUnitCalculator);
    familyOfMissingObj.caseID().specifyValue(caseID);
    familyOfMissingObj.unearnedIncomeAmount().specifyValue(amountTimeline);
    familyOfMissingObj.totalExpenseAmountTimeline().specifyValue(amount2Timeline);
    CREOLETestHelper.assertEquals(
        amount3Timeline, familyOfMissingObj.totalCountableIncomeTimeline().getValue());
  }
  public void testhasHouseholdPassedIncomeTestTimeline1() {
    final Number caseID = 1111L;
    final List<CaseParticipantRole> caseParticipantRoleList = createCaseParticipantRole();
    final List<SAHouseholdUnitMember> saHouseholdUnitMemberList =
        createSAHouseholdUnitMember(caseParticipantRoleList);

    final SAHouseholdUnitCalculator saHouseholdUnitCalculator =
        SAHouseholdUnitCalculator_Factory.getFactory().newInstance(getSession());
    saHouseholdUnitCalculator.mandatoryMembers().specifyValue(saHouseholdUnitMemberList);

    final List<Interval<Number>> amount = new ArrayList<Interval<Number>>();
    amount.add(new Interval<Number>(null, 1000));
    amount.add(new Interval<Number>(Date.fromISO8601("20040601"), 6000));
    final Timeline<Number> amountTimeline = new Timeline<Number>(amount);

    final List<Interval<Number>> amount2 = new ArrayList<Interval<Number>>();
    amount2.add(new Interval<Number>(null, 0));
    amount2.add(new Interval<Number>(Date.fromISO8601("20040601"), 1000));
    final Timeline<Number> amount2Timeline = new Timeline<Number>(amount2);

    final List<Interval<Boolean>> result = new ArrayList<Interval<Boolean>>();
    result.add(new Interval<Boolean>(null, false));
    result.add(new Interval<Boolean>(Date.fromISO8601("20040601"), false));
    final Timeline<Boolean> resultTimeline = new Timeline<Boolean>(result);

    final FamilyOfMissingEligibilityUnitCalculator familyOfMissingObj =
        FamilyOfMissingEligibilityUnitCalculator_Factory.getFactory()
            .newInstance(getSession(), caseID, saHouseholdUnitCalculator);
    familyOfMissingObj.caseID().specifyValue(caseID);
    familyOfMissingObj.totalCountableIncomeTimeline().specifyValue(amountTimeline);
    familyOfMissingObj.primaryBeneficiaryAmount().specifyValue(amount2Timeline);
    CREOLETestHelper.assertEquals(
        resultTimeline, familyOfMissingObj.hasHouseholdPassedIncomeTestTimeline().getValue());
  }
  /**
   * Test case for 'totalExpenseAmountTimeline' attribute. Test Data: Expense records Test Class :
   * FamilyOfMissingEligibilityUnitCalculator
   */
  public void testTotalExpenseAmountTimeline() {
    final Number caseID = 1111L;
    final List<CaseParticipantRole> caseParticipantRoleList = createCaseParticipantRole();
    final List<SAHouseholdUnitMember> saHouseholdUnitMemberList =
        createSAHouseholdUnitMember(caseParticipantRoleList);

    final SAHouseholdUnitCalculator saHouseholdUnitCalculator =
        SAHouseholdUnitCalculator_Factory.getFactory().newInstance(getSession());
    saHouseholdUnitCalculator.mandatoryMembers().specifyValue(saHouseholdUnitMemberList);
    final FamilyOfMissingEligibilityUnitCalculator familyOfMissingObj =
        FamilyOfMissingEligibilityUnitCalculator_Factory.getFactory()
            .newInstance(getSession(), caseID, saHouseholdUnitCalculator);

    final List<Interval<Number>> amount = new ArrayList<Interval<Number>>();
    amount.add(new Interval<Number>(null, 0));
    amount.add(new Interval<Number>(Date.fromISO8601("20040601"), 0));
    final Timeline<Number> amountTimeline = new Timeline<Number>(amount);

    final List<Interval<Number>> amount2 = new ArrayList<Interval<Number>>();
    amount2.add(new Interval<Number>(null, 0));
    amount2.add(new Interval<Number>(Date.fromISO8601("20040601"), 1000));
    final Timeline<Number> amount2Timeline = new Timeline<Number>(amount2);

    // When income type is not COMMERCIAL

    Expense expenseObj = Expense_Factory.getFactory().newInstance(getSession());
    expenseObj.rentAmount().specifyValue(amount2Timeline);
    expenseObj.rentType().specifyValue(new CodeTableItem(EXPENSE.TABLENAME, EXPENSE.COMMERCIAL));
    expenseObj
        .frequency()
        .specifyValue(new CodeTableItem(FREQUENCYCODE.TABLENAME, FREQUENCYCODE.MONTHLY));
    expenseObj
        .participant()
        .specifyValue(caseParticipantRoleList.get(0).caseParticipantRoleID().getValue());
    expenseObj.caseID().specifyValue(caseID);

    final List<Expense> expenseList = new ArrayList<Expense>();
    expenseList.add(expenseObj);

    MemberCPRCalculator memberCPRCalculatorobj =
        MemberCPRCalculator_Factory.getFactory()
            .newInstance(getSession(), caseParticipantRoleList.get(0));
    memberCPRCalculatorobj.caseParticipantRoleRecord().specifyValue(caseParticipantRoleList.get(0));
    memberCPRCalculatorobj.expenseRecords().specifyValue(expenseList);

    familyOfMissingObj.caseID().specifyValue(caseParticipantRoleList.get(0).caseID().getValue());

    CREOLETestHelper.assertEquals(
        amountTimeline, familyOfMissingObj.totalExpenseAmountTimeline().getValue());
  }
  /** Test case for 'HouseholdUnits' attribute. Test Class: FamilyOfMissingHouseholdCalculator */
  public void testHouseholdUnit() {
    final long caseParticipantRoleID = 11L;
    final long participantRoleID = 111L;
    final long caseID = 111L;
    final String Name = "Client_Name";

    createPersonRecord(
        participantRoleID,
        Name,
        Date.fromISO8601("20110615"),
        Date.kZeroDate,
        GENDER.FEMALE,
        MARITALSTATUS.SINGLE);
    final CaseParticipantRole caseParticipantRole =
        createCaseParticipantRoleRecord(
            caseID, caseParticipantRoleID, participantRoleID, CASEPARTICIPANTROLETYPE.PRIMARY);
    createConcernRoleRecord(participantRoleID, Name);
    SAHouseholdUnitMember householdUnitMember = createASAHouseholdUnitMember(caseParticipantRole);
    List<SAHouseholdUnitMember> saHouseholdUnitMembers = new ArrayList<SAHouseholdUnitMember>();
    saHouseholdUnitMembers.add(householdUnitMember);

    SAHouseholdUnitCalculator saHouseholdUnit =
        SAHouseholdUnitCalculator_Factory.getFactory().newInstance(getSession());
    saHouseholdUnit.mandatoryMembers().specifyValue(saHouseholdUnitMembers);
  }
  public void testisFemaleTimeline1() {
    final long caseParticipantRoleID = 11L;
    final long participantRoleID = 111L;
    final long caseID = 111L;
    final String Name = "Pavan";
    createPersonRecord(
        participantRoleID,
        Name,
        Date.fromISO8601("20110615"),
        Date.kZeroDate,
        GENDER.MALE,
        MARITALSTATUS.SINGLE);

    final CaseParticipantRole caseParticipantRole =
        createCaseParticipantRoleRecord(
            caseID, caseParticipantRoleID, participantRoleID, CASEPARTICIPANTROLETYPE.PRIMARY);

    final FamilyOfMissingCPRCalculator familyOfMissingCPRCalculatorObj =
        FamilyOfMissingCPRCalculator_Factory.getFactory()
            .newInstance(getSession(), caseParticipantRole);

    // When gender is specified as Male

    final List<Interval<CodeTableItem>> test1 = new ArrayList<Interval<CodeTableItem>>();
    test1.add(new Interval<CodeTableItem>(null, new CodeTableItem(GENDER.TABLENAME, GENDER.MALE)));
    final Timeline<CodeTableItem> firstTimeline = new Timeline<CodeTableItem>(test1);

    PDCGender pdcGender = PDCGender_Factory.getFactory().newInstance(getSession());
    pdcGender.caseID().specifyValue(caseID);
    pdcGender.gender().specifyValue(firstTimeline);
    pdcGender.person().specifyValue(caseParticipantRole.caseParticipantRoleID().getValue());

    CREOLETestHelper.assertEquals(
        Timeline.FALSE_FOREVER, familyOfMissingCPRCalculatorObj.isFemaleTimeline().getValue());
  }
  /** Creates an object of SAHouseholdUnitMember. */
  public List<SAHouseholdUnitMember> createSAHouseholdUnitMember(
      final List<CaseParticipantRole> caseParticipantRoleList) {
    final Number participantRoleID1 = caseParticipantRoleList.get(0).participantRoleID().getValue();
    final Number participantRoleID2 = caseParticipantRoleList.get(1).participantRoleID().getValue();
    final Number participantRoleID3 = caseParticipantRoleList.get(2).participantRoleID().getValue();
    final Number caseID = caseParticipantRoleList.get(0).caseID().getValue();

    final curam.util.type.Date relationshipStartDate = curam.util.type.Date.fromISO8601("20000101");
    final SAHouseholdUnitMember saHouseholdUnitMember1 =
        SAHouseholdUnitMember_Factory.getFactory()
            .newInstance(this.getSession(), caseID, caseParticipantRoleList.get(0));
    final SAHouseholdUnitMember saHouseholdUnitMember2 =
        SAHouseholdUnitMember_Factory.getFactory()
            .newInstance(this.getSession(), caseID, caseParticipantRoleList.get(1));
    final SAHouseholdUnitMember saHouseholdUnitMember3 =
        SAHouseholdUnitMember_Factory.getFactory()
            .newInstance(this.getSession(), caseID, caseParticipantRoleList.get(2));

    final List<SAHouseholdUnitMember> saHouseholdUnitMemberList =
        new ArrayList<SAHouseholdUnitMember>();
    saHouseholdUnitMemberList.add(saHouseholdUnitMember1);
    saHouseholdUnitMemberList.add(saHouseholdUnitMember2);
    saHouseholdUnitMemberList.add(saHouseholdUnitMember3);
    return saHouseholdUnitMemberList;
  }
  /** Creates an object of a SAHouseholdUnitMember. */
  public SAHouseholdUnitMember createASAHouseholdUnitMember(
      final CaseParticipantRole caseParticipantRole) {
    final Number participantRoleID1 = caseParticipantRole.participantRoleID().getValue();

    final curam.util.type.Date relationshipStartDate = curam.util.type.Date.fromISO8601("20000101");
    final SAHouseholdUnitMember saHouseholdUnitMember1 =
        SAHouseholdUnitMember_Factory.getFactory()
            .newInstance(
                getSession(), caseParticipantRole.caseID().getValue(), caseParticipantRole);

    return saHouseholdUnitMember1;
  }
  public void testisMarriedTimeline1() {
    final long caseParticipantRoleID = 11L;
    final long participantRoleID = 111L;
    final long caseID = 111L;
    final String Name = "Pavan";
    createPersonRecord(
        participantRoleID,
        Name,
        Date.fromISO8601("20110615"),
        Date.kZeroDate,
        GENDER.FEMALE,
        MARITALSTATUS.SINGLE);

    final CaseParticipantRole caseParticipantRole =
        createCaseParticipantRoleRecord(
            caseID, caseParticipantRoleID, participantRoleID, CASEPARTICIPANTROLETYPE.PRIMARY);

    final FamilyOfMissingCPRCalculator familyOfMissingCPRCalculatorObj =
        FamilyOfMissingCPRCalculator_Factory.getFactory()
            .newInstance(getSession(), caseParticipantRole);

    // Specifying marital status as Single

    final List<Interval<CodeTableItem>> test1 = new ArrayList<Interval<CodeTableItem>>();
    test1.add(
        new Interval<CodeTableItem>(
            null, new CodeTableItem(MARITALSTATUS.TABLENAME, MARITALSTATUS.SINGLE)));
    final Timeline<CodeTableItem> maritalStatusTimeline = new Timeline<CodeTableItem>(test1);

    MaritalStatus maritalStatus = MaritalStatus_Factory.getFactory().newInstance(getSession());
    maritalStatus.caseID().specifyValue(caseID);
    maritalStatus.maritalStatus().specifyValue(maritalStatusTimeline);
    maritalStatus
        .participant()
        .specifyValue(caseParticipantRole.caseParticipantRoleID().getValue());

    CREOLETestHelper.assertEquals(
        Timeline.FALSE_FOREVER, familyOfMissingCPRCalculatorObj.isMarriedTimeline().getValue());
  }