@Test public void testUnrecognizedUrl() { assertTrue(underTest.getVendorByJdbcUrl("unrecognized").isEmpty()); }
public Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl) { for (DatabaseVendor databaseVendor : DatabaseVendor.values()) { if (jdbcUrl.startsWith(String.format("jdbc:%s:", databaseVendor.jdbcUrlDriverId()))) { return Optional.of(databaseVendor); } } return Optional.empty(); }
DatabaseVendorUtil { public Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl) { for (DatabaseVendor databaseVendor : DatabaseVendor.values()) { if (jdbcUrl.startsWith(String.format("jdbc:%s:", databaseVendor.jdbcUrlDriverId()))) { return Optional.of(databaseVendor); } } return Optional.empty(); } }
DatabaseVendorUtil { public Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl) { for (DatabaseVendor databaseVendor : DatabaseVendor.values()) { if (jdbcUrl.startsWith(String.format("jdbc:%s:", databaseVendor.jdbcUrlDriverId()))) { return Optional.of(databaseVendor); } } return Optional.empty(); }  }
DatabaseVendorUtil { public Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl) { for (DatabaseVendor databaseVendor : DatabaseVendor.values()) { if (jdbcUrl.startsWith(String.format("jdbc:%s:", databaseVendor.jdbcUrlDriverId()))) { return Optional.of(databaseVendor); } } return Optional.empty(); }  Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl); }
DatabaseVendorUtil { public Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl) { for (DatabaseVendor databaseVendor : DatabaseVendor.values()) { if (jdbcUrl.startsWith(String.format("jdbc:%s:", databaseVendor.jdbcUrlDriverId()))) { return Optional.of(databaseVendor); } } return Optional.empty(); }  Optional<DatabaseVendor> getVendorByJdbcUrl(String jdbcUrl);  }