Search in sources :

Example 81 with Property

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)));
}
Also used : Calendar(java.util.Calendar) Property(com.pholser.junit.quickcheck.Property)

Example 82 with Property

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());
}
Also used : Calendar(java.util.Calendar) Property(com.pholser.junit.quickcheck.Property)

Aggregations

Property (com.pholser.junit.quickcheck.Property)82 Matchers.hasProperty (org.hamcrest.Matchers.hasProperty)15 Program (com.rox.emu.processor.mos6502.util.Program)12 Role (ai.grakn.concept.Role)11 Label (ai.grakn.concept.Label)10 MetaSchema.isMetaLabel (ai.grakn.util.Schema.MetaSchema.isMetaLabel)10 Mos6502Compiler (com.rox.emu.processor.mos6502.util.Mos6502Compiler)10 SchemaConcept (ai.grakn.concept.SchemaConcept)9 RelationshipType (ai.grakn.concept.RelationshipType)8 AttributeType (ai.grakn.concept.AttributeType)7 VarProperty (ai.grakn.graql.admin.VarProperty)5 Ignore (org.junit.Ignore)5 Relationship (ai.grakn.concept.Relationship)4 Calendar (java.util.Calendar)4 Schema (org.apache.beam.sdk.schemas.Schema)4 ConceptId (ai.grakn.concept.ConceptId)3 Entity (ai.grakn.concept.Entity)3 EntityType (ai.grakn.concept.EntityType)3 Type (ai.grakn.concept.Type)3 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)3