public void testFindLastPivotBefore() { Date date = new GregorianCalendar(2015, Calendar.DECEMBER, 8).getTime(); logTest( "testFindLastPivotBefore: %s, which: %s", Util.SIMPLE_DATE_FORMAT.format(date), ss.pkez().getName()); TTransaction e = ts.findLastPivotBefore(date, ss.pkez()); log("Pivot found: %s", e); }
public void testFindFirstPivotAfter_WhenNoPivot() { Date date = new GregorianCalendar(2016, Calendar.APRIL, 22).getTime(); logTest( "testFindFirstPivotAfter_WhenNoPivot: %s, which: %s", Util.SIMPLE_DATE_FORMAT.format(date), ss.pkez().getName()); TTransaction fromPivot = ts.findLastPivotBefore(date, ss.pkez()); log("Pivot found before: %s", fromPivot); TTransaction toPivot = ts.findFirstPivotAfter(date, ss.pkez()); log("Pivot found after : %s [should be null]", toPivot); List<TTransaction> dirtyElements = ts.findElementsBetween( fromPivot == null ? date : fromPivot.getDate(), toPivot == null ? null : toPivot.getDate(), ss.pkez()); log("The dirty list is as follows:"); for (TTransaction t : dirtyElements) log("dirty: %s", t); }
private List<TTransaction> findDirtyElements(Date from, Date to, TChargeAccount ca) { TTransaction fromPivot = service.findLastPivotBefore(from, ca); TTransaction toPivot = service.findFirstPivotAfter(to, ca); info("from, to PIVOT elements [can be null as well]: "); info("%s", fromPivot); info("%s", toPivot); Assert.assertTrue( fromPivot == null || toPivot == null || fromPivot.getDate().getTime() <= toPivot.getDate().getTime()); List<TTransaction> dirtyElements = service.findElementsBetween( fromPivot == null ? from : fromPivot.getDate(), toPivot == null ? null : toPivot.getDate(), ca); info("the dirty list is as follows:"); for (TTransaction t : dirtyElements) info("%s", t); return dirtyElements; }