use of com.pholser.junit.quickcheck.Property in project MaterialDateTimePicker by wdullaer.
the class DefaultDateRangeLimiterPropertyTest method setToNearestShouldNeverBeInDisabledDays.
@Property
public void setToNearestShouldNeverBeInDisabledDays(@InRange(min = "01/01/1900", max = "12/31/2099", format = "MM/dd/yyyy") Date date, @InRange(min = "01/01/1900", max = "12/31/2099", format = "MM/dd/yyyy") Date[] dates) {
DefaultDateRangeLimiter limiter = new DefaultDateRangeLimiter();
Calendar day = Calendar.getInstance();
day.setTime(date);
Calendar[] disableds = datesToCalendars(dates);
limiter.setDisabledDays(disableds);
Assert.assertFalse(Arrays.asList(disableds).contains(limiter.setToNearestDate(day)));
}
use of com.pholser.junit.quickcheck.Property in project MaterialDateTimePicker by wdullaer.
the class DefaultDateRangeLimiterPropertyTest method setToNearestShouldNeverBeBelowMinDate.
@Property
public void setToNearestShouldNeverBeBelowMinDate(@InRange(min = "01/01/1900", max = "12/31/2099", format = "MM/dd/yyyy") Date date, @InRange(min = "01/01/1900", max = "12/31/2099", format = "MM/dd/yyyy") Date minDate) {
DefaultDateRangeLimiter limiter = new DefaultDateRangeLimiter();
Calendar day = Calendar.getInstance();
day.setTime(date);
Calendar minDay = Calendar.getInstance();
minDay.setTime(minDate);
limiter.setMinDate(minDay);
Assert.assertTrue(Utils.trimToMidnight(minDay).getTimeInMillis() <= limiter.setToNearestDate(day).getTimeInMillis());
}
Aggregations