use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BudgetOverride_IntegTest method findOrCreateValuesTest.
@Test
public void findOrCreateValuesTest() {
// given
Lease leaseTopModel = Lease_enum.OxfTopModel001Gb.findUsing(serviceRegistry);
Charge invoiceCharge = Charge_enum.GbServiceCharge.findUsing(serviceRegistry);
BigDecimal overrideValue = new BigDecimal("1234.56");
String reason = "Some reason";
budgetOverrideForFixed = wrap(budgetOverrideRepository).newBudgetOverrideForFixed(overrideValue, leaseTopModel, null, null, invoiceCharge, null, null, reason);
assertThat(budgetOverrideValueRepository.allBudgetOverrideValues().size()).isEqualTo(0);
// when
budgetOverrideForFixed.findOrCreateValues(new LocalDate(2015, 01, 01));
// then
assertThat(budgetOverrideForFixed.getValues().size()).isEqualTo(2);
assertThat(budgetOverrideForFixed.getValues().first().getType()).isEqualTo(BudgetCalculationType.BUDGETED);
assertThat(budgetOverrideForFixed.getValues().last().getType()).isEqualTo(BudgetCalculationType.ACTUAL);
// and when again
budgetOverrideForFixed.findOrCreateValues(new LocalDate(2015, 01, 01));
// then still
assertThat(budgetOverrideForFixed.getValues().size()).isEqualTo(2);
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BudgetAssignmentService_Test method before.
@Before
public void before() throws Exception {
budgetAssignmentService = new BudgetAssignmentService();
o1 = new Occupancy();
leaseWith1ActiveOccupancy = new Lease() {
@Override
public SortedSet<Occupancy> getOccupancies() {
return new TreeSet<>(Arrays.asList(o1));
}
};
o2 = new Occupancy();
o3 = new Occupancy();
leaseWith2ActiveOccupancies = new Lease() {
@Override
public SortedSet<Occupancy> getOccupancies() {
return new TreeSet<>(Arrays.asList(o2, o3));
}
};
o4 = new Occupancy();
leaseWithNoActiveOccupancies = new Lease() {
@Override
public SortedSet<Occupancy> getOccupancies() {
return new TreeSet<>(Arrays.asList(o4));
}
};
o5 = new Occupancy();
leaseTerminated = new Lease() {
@Override
public SortedSet<Occupancy> getOccupancies() {
return new TreeSet<>(Arrays.asList(o5));
}
};
budget = new Budget();
LocalDate startDate = new LocalDate(2015, 01, 01);
LocalDate endDate = new LocalDate(2015, 12, 31);
budget.setStartDate(startDate);
budget.setEndDate(endDate);
LeaseRepository leaseRepository = new LeaseRepository() {
@Override
public List<Lease> findLeasesByProperty(final Property property) {
return Arrays.asList(leaseWith1ActiveOccupancy, leaseWith2ActiveOccupancies, leaseWithNoActiveOccupancies, leaseTerminated);
}
};
budgetAssignmentService.leaseRepository = leaseRepository;
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BudgetAssignmentService_Test method findOrCreateLeaseItemForServiceChargeBudgeted_works_when_no_item_to_copy_from_found.
@Test
public void findOrCreateLeaseItemForServiceChargeBudgeted_works_when_no_item_to_copy_from_found() throws Exception {
// given
BudgetAssignmentService budgetAssignmentService = new BudgetAssignmentService() {
@Override
LeaseItem findItemToCopyFrom(final Lease lease) {
return null;
}
};
Charge charge = new Charge();
BudgetCalculationResult budgetCalculationResult = new BudgetCalculationResult();
budgetCalculationResult.setInvoiceCharge(charge);
LocalDate termStartDate = new LocalDate(2018, 1, 1);
InvoicingFrequency invoicingFrequencyGuess = InvoicingFrequency.QUARTERLY_IN_ADVANCE;
PaymentMethod paymentMethodGuess = PaymentMethod.DIRECT_DEBIT;
// expect
context.checking(new Expectations() {
{
oneOf(mockLease).findFirstActiveItemOfTypeAndChargeOnDate(LeaseItemType.SERVICE_CHARGE, charge, termStartDate);
will(returnValue(null));
oneOf(mockLease).newItem(LeaseItemType.SERVICE_CHARGE, LeaseAgreementRoleTypeEnum.LANDLORD, budgetCalculationResult.getInvoiceCharge(), invoicingFrequencyGuess, paymentMethodGuess, termStartDate);
}
});
// when
budgetAssignmentService.findOrCreateLeaseItemForServiceChargeBudgeted(mockLease, budgetCalculationResult, termStartDate);
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BudgetAssignmentService_Test method leasesWithActiveOccupanciesTest.
@Test
public void leasesWithActiveOccupanciesTest() {
// given
o1.setStartDate(new LocalDate(2015, 01, 01));
o2.setStartDate(new LocalDate(2015, 01, 01));
o3.setStartDate(new LocalDate(2015, 01, 01));
o4.setEndDate(new LocalDate(2014, 12, 31));
o5.setStartDate(new LocalDate(2015, 01, 01));
leaseTerminated.setStatus(LeaseStatus.TERMINATED);
// when
List<Lease> leasesfound = budgetAssignmentService.leasesWithActiveOccupations(budget);
// then
assertThat(leasesfound.size()).isEqualTo(2);
assertThat(leasesfound.get(0)).isEqualTo(leaseWith1ActiveOccupancy);
assertThat(leasesfound.get(1)).isEqualTo(leaseWith2ActiveOccupancies);
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BudgetAssignmentService_Test method itemToCopyFrom_when_no_items_on_lease_returns_null.
@Test
public void itemToCopyFrom_when_no_items_on_lease_returns_null() throws Exception {
// given
Lease lease = new Lease();
// when
LeaseItem itemFound = budgetAssignmentService.findItemToCopyFrom(lease);
// then
assertThat(itemFound).isNull();
}
Aggregations