PropertyTaxUtil { public static Long getNumberOfDays(final Date fromDate, final Date toDate) { LOGGER.debug("Entered into getNumberOfDays, fromDate=" + fromDate + ", toDate=" + toDate); final DateTime startDate = new DateTime(fromDate); final DateTime endDate = new DateTime(toDate); Integer days = Days.daysBetween(startDate, endDate).getDays(); days = days < 0 ? 0 : days; return Long.valueOf(days.longValue()); }  void setPersistenceService(final PersistenceService persistenceService); CFinancialYear getFinancialYearforDate(final Date date); List<Installment> getInstallmentListByStartDate(final Date startDate); List<Installment> getInstallmentListByStartDateToCurrFinYearDesc(final Date startDate); EgDemandReason getDemandReasonByCodeAndInstallment(final String demandReasonCode,
                                                              final Installment installment); TaxCalculationInfo getTaxCalInfo(final Ptdemand demand); Map<String, Map<String, BigDecimal>> getDemandDues(final String propertyId); HashMap<String, Integer> generateOrderForDemandDetails(final Set<EgDemandDetails> demandDetails,
                                                                  final PropertyTaxBillable billable, final List<Installment> advanceInstallments); List<Department> getDepartmentsForLoggedInUser(final User user); Designation getDesignationForUser(final Long userId); EgBillType getBillTypeByCode(final String typeCode); Date getOrder(final Date date, final int reasonOrder); UnitTaxCalculationInfo getUnitTaxCalculationInfoClone(final UnitTaxCalculationInfo unit); void addMiscellaneousTaxesClone(final UnitTaxCalculationInfo unit, final UnitTaxCalculationInfo clone); static Long getNumberOfDays(final Date fromDate, final Date toDate); Boolean between(final Date date, final Date fromDate, final Date toDate); static int getMonthsBetweenDates(final Date fromDate, final Date toDate); String antisamyHackReplace(final String str); Map<String, BigDecimal> getDemandAndCollection(final Property property); void makeTheEgBillAsHistory(final BasicProperty basicProperty); static String buildAddress(final Address address); static String getOwnerAddress(final List<PropertyOwnerInfo> ownerSet); String getDesignationName(final Long userId); Date getPropertyOccupancyDate(final Property property); Installment getPTInstallmentForDate(final Date date); Date getEarliestModificationDate(final String propertyId); static Date getWaterTaxEffectiveDateForPenalty(); Map<String, Map<Installment, BigDecimal>> prepareReasonWiseDenandAndCollection(final Property property,
                                                                                          final Installment currentInstallment); @SuppressWarnings("unchecked") Map<String, Map<String, BigDecimal>> prepareDemandDetForView(final Property property,
                                                                        final Installment currentInstallment); @SuppressWarnings("unchecked") Map<Date, Property> getPropertiesForPenlatyCalculation(final BasicProperty basicProperty); static boolean afterOrEqual(final Date date, final Date dateToCompare); DepreciationMaster getDepreciationByDate(final Date constructionDate, final Date effectiveDate); List<InstrumentType> prepareInstrumentTypeList(); Boolean isCorporation(); Boolean isSeaShoreULB(); Boolean isPrimaryServiceApplicable(); String getRolesForUserId(final Long userId); String generateUserName(final String mobileNumber); Query prepareQueryforCollectionSummaryReport(final String fromDate, final String toDate,
                                                        final String collMode, final String transMode, final String mode, final String boundaryId,
                                                        final String propTypeCategoryId, final Long zoneId, final Long wardId, final Long blockId); Query prepareQueryforTitleTransferReport(final Long zoneId, final Long wardId, final Long areaId,
                                                    final String fromDate, final String toDate); @SuppressWarnings("unchecked") BigDecimal getPropertyTaxDetails(final Long basicPropId, final CFinancialYear finyear); Map<String, BigDecimal> prepareDemandDetForWorkflowProperty(final Property property,
                                                                       final Installment dmdInstallment, final Installment dmdDetInstallment); String getApproverUserName(final Long approvalPosition); boolean enableVacancyRemission(final String upicNo); boolean enableMonthlyUpdate(final String upicNo); boolean enableVRApproval(final String upicNo); boolean checkForParentUsedInBifurcation(final String upicNo); Date getLowestInstallmentForProperty(final Property property); boolean checkIsNagarPanchayat(); Query prepareQueryforDefaultersReport(final Long wardId, final String fromDemand, final String toDemand,
                                                 final Integer limit, final String ownerShipType, final String proptype); boolean isWard(final Long wardId); List<Installment> getInstallments(final PropertyImpl property); Map<String, Installment> getInstallmentsForCurrYear(final Date currDate); Date getEffectiveDateForProperty(Property property); Map<String, BigDecimal> getTaxDetailsForInstallment(final Property property, final Installment effectiveInstallment,
                                                               final Installment demandInstallment); List<Installment> getInstallmentsListByEffectiveDate(final Date effectiveDate); int getNoOfYears(final Date fromDate, final Date toDate); ReportOutput generateCitizenCharterAcknowledgement(final String propertyId, final String applicationType,
                                                              final String serviceType, final String applicationNo); BigDecimal getRebateAmount(EgDemand currentDemand); BigDecimal getCurrentDemandForRebateCalculation(BasicProperty basicProperty); BigDecimal getTaxDifferenceForGIS(PropertyImpl propertyImpl); BigDecimal getTaxRates(); boolean isEligibleforWaiver(Boolean paymentTypeFullPayment, String consumerCode); boolean isEligibleforWaiver(Date outCutOffDate); String makeRemarkWithRcptNo(String remark, String rcptNo); String getRcptNoFromRemark(String remark);  }
@Test public void sameDayShouldReturnZero() { DateTime date = new DateTime(); long noofdays = PropertyTaxUtil.getNumberOfDays(date.toDate(), date.toDate()); assertEquals(noofdays, 0L); }
@Test public void differentDates() { DateTime start = new DateTime(2016, 8, 1, 12, 0, 0, 0); DateTime end = new DateTime(2016, 8, 30, 12, 0, 0, 0); long noofdays = PropertyTaxUtil.getNumberOfDays(start.toDate(), end.toDate()); assertEquals(noofdays, 29L); }
@Test public void negativeResult() { DateTime start = new DateTime(2016, 7, 15, 12, 0, 0, 0); DateTime end = new DateTime(2016, 7, 1, 12, 0, 0, 0); long noofdays = PropertyTaxUtil.getNumberOfDays(start.toDate(), end.toDate()); assertEquals(noofdays, 0L); }