use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class Property_vacantUnits_Test method vacant_Units_works.
@Test
public void vacant_Units_works() throws Exception {
// given
Property property = new Property();
Unit unit1 = new Unit();
Unit unit2 = new Unit();
Property_vacantUnits mixin = new Property_vacantUnits(property);
mixin.unitRepository = mockUnitRepository;
mixin.occupancyRepository = mockOccupancyRepository;
mixin.clockService = mockClockService;
LocalDate now = new LocalDate(2017, 01, 01);
// expect
context.checking(new Expectations() {
{
allowing(mockOccupancyRepository).findByProperty(property);
oneOf(mockUnitRepository).findByProperty(property);
will(returnValue(Arrays.asList(unit1, unit2)));
}
});
// when
List<Unit> expectedVacantUnits = mixin.$$();
// then
Assertions.assertThat(expectedVacantUnits.size()).isEqualTo(2);
// and expect
context.checking(new Expectations() {
{
allowing(mockOccupancyRepository).findByProperty(property);
oneOf(mockUnitRepository).findByProperty(property);
will(returnValue(Arrays.asList(unit1, unit2)));
oneOf(mockClockService).now();
will(returnValue(now));
}
});
// when
unit1.setEndDate(now.plusDays(1));
expectedVacantUnits = mixin.$$();
// then
Assertions.assertThat(expectedVacantUnits.size()).isEqualTo(2);
// and expect
context.checking(new Expectations() {
{
allowing(mockOccupancyRepository).findByProperty(property);
oneOf(mockUnitRepository).findByProperty(property);
will(returnValue(Arrays.asList(unit1, unit2)));
oneOf(mockClockService).now();
will(returnValue(now));
}
});
// when
unit1.setEndDate(now);
expectedVacantUnits = mixin.$$();
// then
Assertions.assertThat(expectedVacantUnits.size()).isEqualTo(1);
Assertions.assertThat(expectedVacantUnits).doesNotContain(unit1);
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class EstatioApplicationTenancyRepositoryForLease_Test method testPathForPartyProperty.
@Test
public void testPathForPartyProperty() throws Exception {
// given
final Property p = propertyWith("ITA", "GRA");
final Party pa = partyWith("HELLO");
// then
assertThat(estatioApplicationTenancyRepositoryForLease.pathFor(p, pa)).isEqualTo("/ITA/GRA/HELLO");
}
Aggregations