public void testBigHashtable() { Converter[] array = new Converter[] { c1, c2, c3, c4, }; ConverterSet set = new ConverterSet(array); set.select(Boolean.class); set.select(Character.class); set.select(Byte.class); set.select(Short.class); set.select(Integer.class); set.select(Long.class); set.select(Float.class); set.select(Double.class); set.select(null); set.select(Calendar.class); set.select(GregorianCalendar.class); set.select(DateTime.class); set.select(DateMidnight.class); set.select(ReadableInstant.class); set.select(ReadableDateTime.class); set.select(ReadWritableInstant.class); // 16 set.select(ReadWritableDateTime.class); set.select(DateTime.class); assertEquals(4, set.size()); }
@Override public Object create(Object request, SpecimenContext context) { if (!(request.equals(ReadableInstant.class) || request.equals(ReadWritableInstant.class) || request.equals(ReadableDateTime.class) || request.equals(ReadWritableDateTime.class))) { return new NoSpecimen(); } DateTime date = (DateTime) context.resolve(DateTime.class); return new MutableDateTime(date); }
@Test public void creates_instance_of_ReadWritableDateTime() throws ParseException { ReadWritableDateTime dateTime = fixture.create(ReadWritableDateTime.class); assertThat(dateTime, notNullValue()); assertThat(new Date(dateTime.getMillis()), is(date)); }