@Test public void date_type_request_returns_date_instance() { Object result = this.dateGenerator.create(Date.class, null); assertTrue(result instanceof Date); }
@Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Date.class)) { return new NoSpecimen(); } Date nowDate = new Date(this.timeProvider.getCurrentTimeInMilliseconds()); long min = getTwoYearsAgoMs(nowDate); long max = getTwoYearsAheadMs(nowDate); long date = FixtureMath.randLong(min, max); return new Date(date); }
DateGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Date.class)) { return new NoSpecimen(); } Date nowDate = new Date(this.timeProvider.getCurrentTimeInMilliseconds()); long min = getTwoYearsAgoMs(nowDate); long max = getTwoYearsAheadMs(nowDate); long date = FixtureMath.randLong(min, max); return new Date(date); } }
DateGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Date.class)) { return new NoSpecimen(); } Date nowDate = new Date(this.timeProvider.getCurrentTimeInMilliseconds()); long min = getTwoYearsAgoMs(nowDate); long max = getTwoYearsAheadMs(nowDate); long date = FixtureMath.randLong(min, max); return new Date(date); } DateGenerator();  DateGenerator(TimeProvider timeProvider); }
DateGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Date.class)) { return new NoSpecimen(); } Date nowDate = new Date(this.timeProvider.getCurrentTimeInMilliseconds()); long min = getTwoYearsAgoMs(nowDate); long max = getTwoYearsAheadMs(nowDate); long date = FixtureMath.randLong(min, max); return new Date(date); } DateGenerator();  DateGenerator(TimeProvider timeProvider); @Override Object create(Object request, SpecimenContext context); }
DateGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Date.class)) { return new NoSpecimen(); } Date nowDate = new Date(this.timeProvider.getCurrentTimeInMilliseconds()); long min = getTwoYearsAgoMs(nowDate); long max = getTwoYearsAheadMs(nowDate); long date = FixtureMath.randLong(min, max); return new Date(date); } DateGenerator();  DateGenerator(TimeProvider timeProvider); @Override Object create(Object request, SpecimenContext context);  }