Search in sources :

Example 16 with Occupancy

use of org.estatio.module.lease.dom.occupancy.Occupancy in project estatio by estatio.

the class Property_vacantUnits_Test method occupiedUnits.

@Test
public void occupiedUnits() throws Exception {
    // given
    Property property = new Property();
    Unit unit1 = new Unit();
    Unit unit2 = new Unit();
    Property_vacantUnits mixin = new Property_vacantUnits(property);
    mixin.occupancyRepository = mockOccupancyRepository;
    mixin.clockService = mockClockService;
    // when
    Occupancy occupancy1 = new Occupancy();
    occupancy1.setUnit(unit1);
    Occupancy occupancy2 = new Occupancy();
    occupancy1.setUnit(unit2);
    // expect
    context.checking(new Expectations() {

        {
            oneOf(mockOccupancyRepository).findByProperty(property);
            will(returnValue(Arrays.asList(occupancy1, occupancy2)));
        }
    });
    // then
    Assertions.assertThat(mixin.occupiedUnits().size()).isEqualTo(2);
    // and when
    LocalDate now = new LocalDate(2017, 01, 01);
    occupancy1.setEndDate(now);
    occupancy2.setEndDate(now.plusDays(1));
    // expect
    context.checking(new Expectations() {

        {
            oneOf(mockOccupancyRepository).findByProperty(property);
            will(returnValue(Arrays.asList(occupancy1, occupancy2)));
            allowing(mockClockService).now();
            will(returnValue(now));
        }
    });
    // then
    Assertions.assertThat(mixin.occupiedUnits().size()).isEqualTo(1);
}
Also used : Expectations(org.jmock.Expectations) Occupancy(org.estatio.module.lease.dom.occupancy.Occupancy) Unit(org.estatio.module.asset.dom.Unit) Property(org.estatio.module.asset.dom.Property) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 17 with Occupancy

use of org.estatio.module.lease.dom.occupancy.Occupancy in project estatio by estatio.

the class InvoiceItemForLeaseDtoFactory_Test method setUp.

@Before
public void setUp() throws Exception {
    // given
    ChargeGroup chargeGroup = new ChargeGroup();
    chargeGroup.setReference("CG");
    Charge charge = new Charge();
    charge.setReference("CH");
    charge.setExternalReference("CHE");
    charge.setGroup(chargeGroup);
    Tax tax = new Tax();
    Unit unit = new Unit();
    unit.setReference("UN");
    Brand brand = new Brand();
    brand.setName("BRAND");
    Occupancy occupancy = new Occupancy();
    occupancy.setEndDate(new LocalDate(2013, 12, 31));
    occupancy.setUnit(unit);
    occupancy.setBrand(brand);
    Lease lease = new Lease();
    lease.getOccupancies().add(occupancy);
    InvoiceForLease invoice = new InvoiceForLease();
    invoice.setLease(lease);
    invoiceItem = new InvoiceItemForLease();
    invoiceItem.setInvoice(invoice);
    invoiceItem.setCharge(charge);
    invoiceItem.setTax(tax);
}
Also used : Brand(org.estatio.module.lease.dom.occupancy.tags.Brand) Lease(org.estatio.module.lease.dom.Lease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) InvoiceItemForLease(org.estatio.module.lease.dom.invoicing.InvoiceItemForLease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) ChargeGroup(org.estatio.module.charge.dom.ChargeGroup) Occupancy(org.estatio.module.lease.dom.occupancy.Occupancy) Charge(org.estatio.module.charge.dom.Charge) InvoiceItemForLease(org.estatio.module.lease.dom.invoicing.InvoiceItemForLease) Tax(org.estatio.module.tax.dom.Tax) Unit(org.estatio.module.asset.dom.Unit) LocalDate(org.joda.time.LocalDate) Before(org.junit.Before)

Aggregations

Occupancy (org.estatio.module.lease.dom.occupancy.Occupancy)17 Lease (org.estatio.module.lease.dom.Lease)9 Unit (org.estatio.module.asset.dom.Unit)8 Programmatic (org.apache.isis.applib.annotation.Programmatic)6 InvoiceForLease (org.estatio.module.lease.dom.invoicing.InvoiceForLease)3 Brand (org.estatio.module.lease.dom.occupancy.tags.Brand)3 LocalDate (org.joda.time.LocalDate)3 ArrayList (java.util.ArrayList)2 AgreementRole (org.estatio.module.agreement.dom.AgreementRole)2 Property (org.estatio.module.asset.dom.Property)2 Budget (org.estatio.module.budget.dom.budget.Budget)2 Charge (org.estatio.module.charge.dom.Charge)2 ChargeGroup (org.estatio.module.charge.dom.ChargeGroup)2 InvoiceItemForLease (org.estatio.module.lease.dom.invoicing.InvoiceItemForLease)2 Tax (org.estatio.module.tax.dom.Tax)2 Expectations (org.jmock.Expectations)2 Before (org.junit.Before)2 Test (org.junit.Test)2 BigDecimal (java.math.BigDecimal)1 SortedSet (java.util.SortedSet)1