@Test
  public void givenIndexableRentItem_thenCreatesTermsForThatItemOnly() throws Exception {

    // given
    assertNull(leaseTopModelRentItem.findTerm(VT.ld(2012, 7, 15)));
    assertNull(leaseTopModelServiceChargeItem.findTerm(VT.ld(2012, 7, 15)));

    // when
    leaseTopModelRentItem.verify();

    // then
    assertNotNull(leaseTopModelRentItem.findTerm(VT.ld(2012, 7, 15)));
    assertNull(leaseTopModelServiceChargeItem.findTerm(VT.ld(2012, 7, 15)));
  }
Esempio n. 2
0
 public LeaseItem copy(
     final @ParameterLayout(named = "Start date") LocalDate startDate,
     final InvoicingFrequency invoicingFrequency,
     final PaymentMethod paymentMethod,
     final Charge charge) {
   final LeaseItem newItem =
       getLease()
           .newItem(
               this.getType(),
               charge,
               invoicingFrequency,
               paymentMethod,
               startDate,
               getApplicationTenancy());
   this.copyTerms(startDate, newItem);
   this.changeDates(getStartDate(), newItem.getInterval().endDateFromStartDate());
   return newItem;
 }
Esempio n. 3
0
 @Programmatic
 public void copyTerms(final LocalDate startDate, final LeaseItem newItem) {
   LeaseTerm lastTerm = null;
   for (LeaseTerm term : getTerms()) {
     if (term.getInterval().contains(startDate)) {
       LeaseTerm newTerm;
       if (lastTerm == null) {
         newTerm = newItem.newTerm(term.getStartDate(), null);
       } else {
         newTerm = lastTerm.createNext(term.getStartDate(), term.getEndDate());
       }
       term.copyValuesTo(newTerm);
       lastTerm = newTerm;
     }
   }
 }
Esempio n. 4
0
 public LeaseItemStatus apply(final LeaseItem li) {
   return li.getStatus();
 }
 @Test
 public void changeDatesDelegate() {
   leaseItem = new LeaseItem();
   assertThat(leaseItem.getChangeDates(), is(not(nullValue())));
 }