@Test public void returns_gregorian_calendar_with_resolved_date() { Object result = this.builder.create(Calendar.class, mockContext); assertTrue(result instanceof GregorianCalendar); assertEquals(date, ((Calendar) result).getTime()); }
@Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Calendar.class)) { return new NoSpecimen(); } Object dateResult = context.resolve(Date.class); if (dateResult instanceof NoSpecimen) { return new NoSpecimen(); } Date date = (Date) dateResult; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; }
CalendarBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Calendar.class)) { return new NoSpecimen(); } Object dateResult = context.resolve(Date.class); if (dateResult instanceof NoSpecimen) { return new NoSpecimen(); } Date date = (Date) dateResult; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; } }
CalendarBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Calendar.class)) { return new NoSpecimen(); } Object dateResult = context.resolve(Date.class); if (dateResult instanceof NoSpecimen) { return new NoSpecimen(); } Date date = (Date) dateResult; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; }  }
CalendarBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Calendar.class)) { return new NoSpecimen(); } Object dateResult = context.resolve(Date.class); if (dateResult instanceof NoSpecimen) { return new NoSpecimen(); } Date date = (Date) dateResult; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; }  @Override Object create(Object request, SpecimenContext context); }
CalendarBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!request.equals(Calendar.class)) { return new NoSpecimen(); } Object dateResult = context.resolve(Date.class); if (dateResult instanceof NoSpecimen) { return new NoSpecimen(); } Date date = (Date) dateResult; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; }  @Override Object create(Object request, SpecimenContext context);  }