RepositoryFactoryImpl implements RepositoryFactory { static SQLDialect guessSqlDialectFrom(String dataSourceUrl) { for (SQLDialect dialect: SQLDialect.values()) { if (dataSourceUrl.contains(dialect.name().toLowerCase())) { return dialect; } } throw new IllegalArgumentException("unknown SQL dialect for datasource : " + dataSourceUrl); } RepositoryFactoryImpl();  RepositoryFactoryImpl(final PropertiesProvider propertiesProvider); Repository createRepository(); JooqApiKeyRepository createApiKeyRepository(); JooqBatchSearchRepository createBatchSearchRepository(); void initDatabase();  }
@Test public void test_guess_sql_dialect_sqlite() { assertThat(RepositoryFactoryImpl.guessSqlDialectFrom("jdbc:sqlite:file:memorydb.db?mode=memory&cache=shared")).isEqualTo(SQLDialect.SQLITE); assertThat(RepositoryFactoryImpl.guessSqlDialectFrom("jdbc:sqlite: }
@Test public void test_guess_sql_dialect_postgresql() { assertThat(RepositoryFactoryImpl.guessSqlDialectFrom("jdbc:postgresql: }
@Test(expected = IllegalArgumentException.class) public void test_guess_sql_dialect_unknown() { RepositoryFactoryImpl.guessSqlDialectFrom("jdbc:blah"); }