Search in sources :

Example 1 with LocalDate

use of org.joda.time.LocalDate in project cucumber-jvm by cucumber.

the class ParameterInfoTest method converts_with_custom_joda_time_transform_and_format.

@Test
public void converts_with_custom_joda_time_transform_and_format() throws NoSuchMethodException {
    ParameterInfo parameterInfo = ParameterInfo.fromMethod(getClass().getMethod("withJodaTime", LocalDate.class)).get(0);
    LocalDate aslaksBirthday = new LocalDate(1971, 2, 28);
    assertEquals(aslaksBirthday, parameterInfo.convert("28/02/1971", FR));
    assertEquals(aslaksBirthday, parameterInfo.convert("02/28/1971", US));
}
Also used : LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 2 with LocalDate

use of org.joda.time.LocalDate in project cucumber-jvm by cucumber.

the class ParameterInfoTest method converts_to_joda_time_using_object_ctor_and_default_locale.

@Test
public void converts_to_joda_time_using_object_ctor_and_default_locale() throws NoSuchMethodException {
    ParameterInfo parameterInfo = ParameterInfo.fromMethod(getClass().getMethod("withJodaTimeWithoutTransform", LocalDate.class)).get(0);
    LocalDate localDate = new LocalDate("1971");
    assertEquals(localDate, parameterInfo.convert("1971", US));
}
Also used : LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 3 with LocalDate

use of org.joda.time.LocalDate in project cucumber-jvm by cucumber.

the class ParameterInfoTest method converts_with_custom_joda_time_transform.

@Test
public void converts_with_custom_joda_time_transform() throws NoSuchMethodException {
    ParameterInfo parameterInfo = ParameterInfo.fromMethod(getClass().getMethod("withJodaTimeAndFormat", LocalDate.class)).get(0);
    LocalDate aslaksBirthday = new LocalDate(1971, 2, 28);
    assertEquals(aslaksBirthday, parameterInfo.convert("28/02/1971", FR));
    assertEquals(aslaksBirthday, parameterInfo.convert("02/28/1971", US));
}
Also used : LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 4 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class AccountingDataController method showAccountingDataFor.

@RequestMapping("renderAccountingData.ftl")
public final ModelAndView showAccountingDataFor(@RequestParam(value = FROM_DATE) String paramFromDate, @RequestParam(value = TO_DATE) String paramToDate) {
    DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd");
    LocalDate fromDate = fmt.parseDateTime(paramFromDate).toLocalDate();
    LocalDate toDate = fmt.parseDateTime(paramToDate).toLocalDate();
    Boolean hasAlreadyRanQuery = Boolean.FALSE;
    String fileName = null;
    List<AccountingDto> accountingData = new ArrayList<AccountingDto>();
    try {
        fileName = accountingService.getExportOutputFileName(fromDate, toDate).replace(".xml", "");
        hasAlreadyRanQuery = accountingService.hasAlreadyRanQuery(fromDate, toDate);
        accountingData = accountingService.getExportDetails(fromDate, toDate);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    ModelAndView mav = new ModelAndView("renderAccountingData");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("accounting.viewaccountingexports", "renderAccountingDataCacheInfo.ftl").withLink(fileName, "").build();
    mav.addObject("breadcrumbs", breadcrumbs);
    mav.addObject("accountingData", accountingData);
    mav.addObject("hasAlreadyRanQuery", hasAlreadyRanQuery);
    mav.addObject("fileName", fileName);
    mav.addObject("fromDate", fromDate);
    mav.addObject("toDate", toDate);
    return mav;
}
Also used : ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) BreadCrumbsLinks(org.mifos.ui.core.controller.BreadCrumbsLinks) AccountingDto(org.mifos.platform.accounting.AccountingDto) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) LocalDate(org.joda.time.LocalDate) AdminBreadcrumbBuilder(org.mifos.ui.core.controller.AdminBreadcrumbBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class AccountBO method getDetailsOfInstallmentsInArrearsOn.

public List<AccountActionDateEntity> getDetailsOfInstallmentsInArrearsOn(LocalDate asOf) {
    List<AccountActionDateEntity> installmentsInArrears = new ArrayList<AccountActionDateEntity>();
    Set<AccountActionDateEntity> accountActionDates = getAccountActionDates();
    if (accountActionDates != null && !accountActionDates.isEmpty()) {
        for (AccountActionDateEntity accountAction : accountActionDates) {
            LocalDate installmentDate = new LocalDate(accountAction.getActionDate());
            if (asOf.isAfter(installmentDate) && !accountAction.isPaid() || asOf.isEqual(installmentDate)) {
                installmentsInArrears.add(accountAction);
            }
        }
    }
    return installmentsInArrears;
}
Also used : ArrayList(java.util.ArrayList) LocalDate(org.joda.time.LocalDate)

Aggregations

LocalDate (org.joda.time.LocalDate)1685 Test (org.testng.annotations.Test)826 BigDecimal (java.math.BigDecimal)591 DateTime (org.joda.time.DateTime)343 UUID (java.util.UUID)332 Test (org.junit.Test)312 ArrayList (java.util.ArrayList)298 Account (org.killbill.billing.account.api.Account)297 Invoice (org.killbill.billing.invoice.api.Invoice)292 DefaultEntitlement (org.killbill.billing.entitlement.api.DefaultEntitlement)204 ExpectedInvoiceItemCheck (org.killbill.billing.beatrix.util.InvoiceChecker.ExpectedInvoiceItemCheck)201 InvoiceItem (org.killbill.billing.invoice.api.InvoiceItem)199 PlanPhaseSpecifier (org.killbill.billing.catalog.api.PlanPhaseSpecifier)153 FixedPriceInvoiceItem (org.killbill.billing.invoice.model.FixedPriceInvoiceItem)141 RecurringInvoiceItem (org.killbill.billing.invoice.model.RecurringInvoiceItem)137 DefaultEntitlementSpecifier (org.killbill.billing.entitlement.api.DefaultEntitlementSpecifier)105 DefaultInvoice (org.killbill.billing.invoice.model.DefaultInvoice)105 HashMap (java.util.HashMap)101 AccountData (org.killbill.billing.account.api.AccountData)96 ItemAdjInvoiceItem (org.killbill.billing.invoice.model.ItemAdjInvoiceItem)96