protected void setDefaultArgumentFactorySet() { argumentFactorySet.add(new UUIDArgumentFactory()); argumentFactorySet.add(new DateTimeZoneArgumentFactory()); argumentFactorySet.add(new DateTimeArgumentFactory()); argumentFactorySet.add(new LocalDateArgumentFactory()); }
@Test(groups = "slow") public void testWithArgument() throws Exception { dbi.registerArgumentFactory(new LocalDateArgumentFactory()); final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class); final LocalDate localDatePierre = new LocalDate(2012, 5, 12); somethingSqlDao.create(1, "pierre", localDatePierre); final LocalDate localDateStephane = new LocalDate(2009, 3, 9); somethingSqlDao.create(2, "stephane", localDateStephane); final String localDateStringPierre = somethingSqlDao.getCreatedDt(1); Assert.assertEquals(localDateStringPierre, localDatePierre.toString()); final String localDateStringStephane = somethingSqlDao.getCreatedDt(2); Assert.assertEquals(localDateStringStephane, localDateStephane.toString()); }
@VisibleForTesting public static void setupDBI(final DBI dbi) { dbi.registerArgumentFactory(new UUIDArgumentFactory()); dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory()); dbi.registerArgumentFactory(new DateTimeArgumentFactory()); dbi.registerArgumentFactory(new LocalDateArgumentFactory()); dbi.registerMapper(new UUIDMapper()); dbi.registerMapper(new LowerToCamelBeanMapperFactory(BusEventModelDao.class)); dbi.registerMapper(new LowerToCamelBeanMapperFactory(NotificationEventModelDao.class)); }