ServletConfigFactory implements Supplier<Configuration> { @Override public Configuration get() { return new HibernateConfiguration(factory, GROUP_NAME); } @Inject  ServletConfigFactory(final SessionFactory factory); @Override Configuration get(); static final String GROUP_NAME; }
@Test public void testCreateConfiguration() { HibernateConfiguration compareConfig = new HibernateConfiguration(getSessionFactory(), ServletConfigFactory.GROUP_NAME); compareConfig.addProperty("test", "property"); ServletConfigFactory factory = new ServletConfigFactory(getSessionFactory()); Configuration created = factory.get(); assertEquals("property", created.getString("test")); }
@Test public void testGenericInterface() throws Exception { Supplier factory = new ServletConfigFactory(getSessionFactory()); Object instance = factory.get(); assertTrue(instance instanceof HibernateConfiguration); }