fix end of month bug in PeriodDropRule as well

This commit is contained in:
xvrl 2013-01-02 15:44:14 -08:00
parent 0543322c56
commit a9b8d8f1ce
2 changed files with 8 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public class PeriodDropRule extends DropRule
@Override
public boolean appliesTo(DataSegment segment, DateTime referenceTimestamp)
{
final Interval currInterval = new Interval(referenceTimestamp.minus(period), period);
final Interval currInterval = new Interval(period, referenceTimestamp);
return currInterval.contains(segment.getInterval());
}
}

View File

@ -79,6 +79,13 @@ public class PeriodDropRuleTest
now
)
);
Assert.assertTrue(
rule.appliesTo(
builder.interval(new Interval(now.minusDays(1), now))
.build(),
now
)
);
Assert.assertFalse(
rule.appliesTo(
builder.interval(new Interval(now.minusYears(1), now.minusDays(1)))