@Test void testGetDatabaseUrlWrongHostName() throws Exception { SimpleDatabasePlatformSupport simpleDatabasePlatformSupport = new SimpleDatabasePlatformSupport(); assertThatThrownBy(() -> simpleDatabasePlatformSupport.getDatabaseUrlForDatabase( DatabaseType.MYSQL, "localhost<", 3306, "testDb")) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining( "Error constructing URI from Host:'localhost<'"); }
@Override public String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname, int port, String databaseName) { String scheme = this.getSchemeNames().get(databaseType); String authenticationInfo = this.getAuthenticationInfo().get(databaseType); Assert.notNull(databaseType, String .format("No scheme name found for database :'%s'", databaseType.name())); try { return new URI(scheme, authenticationInfo, hostname, port, databaseName != null ? "/" + databaseName : null, null, null) .toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Error constructing URI from Host:'" + hostname + "' and port:'" + port + "' and database name:'" + databaseName + "'!"); } }
MapBasedDatabasePlatformSupport implements DatabasePlatformSupport { @Override public String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname, int port, String databaseName) { String scheme = this.getSchemeNames().get(databaseType); String authenticationInfo = this.getAuthenticationInfo().get(databaseType); Assert.notNull(databaseType, String .format("No scheme name found for database :'%s'", databaseType.name())); try { return new URI(scheme, authenticationInfo, hostname, port, databaseName != null ? "/" + databaseName : null, null, null) .toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Error constructing URI from Host:'" + hostname + "' and port:'" + port + "' and database name:'" + databaseName + "'!"); } } }
MapBasedDatabasePlatformSupport implements DatabasePlatformSupport { @Override public String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname, int port, String databaseName) { String scheme = this.getSchemeNames().get(databaseType); String authenticationInfo = this.getAuthenticationInfo().get(databaseType); Assert.notNull(databaseType, String .format("No scheme name found for database :'%s'", databaseType.name())); try { return new URI(scheme, authenticationInfo, hostname, port, databaseName != null ? "/" + databaseName : null, null, null) .toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Error constructing URI from Host:'" + hostname + "' and port:'" + port + "' and database name:'" + databaseName + "'!"); } }  }
MapBasedDatabasePlatformSupport implements DatabasePlatformSupport { @Override public String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname, int port, String databaseName) { String scheme = this.getSchemeNames().get(databaseType); String authenticationInfo = this.getAuthenticationInfo().get(databaseType); Assert.notNull(databaseType, String .format("No scheme name found for database :'%s'", databaseType.name())); try { return new URI(scheme, authenticationInfo, hostname, port, databaseName != null ? "/" + databaseName : null, null, null) .toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Error constructing URI from Host:'" + hostname + "' and port:'" + port + "' and database name:'" + databaseName + "'!"); } }  @Override String getDriverClassNameForDatabase(DatabaseType databaseType); @Override String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname,
			int port, String databaseName); }
MapBasedDatabasePlatformSupport implements DatabasePlatformSupport { @Override public String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname, int port, String databaseName) { String scheme = this.getSchemeNames().get(databaseType); String authenticationInfo = this.getAuthenticationInfo().get(databaseType); Assert.notNull(databaseType, String .format("No scheme name found for database :'%s'", databaseType.name())); try { return new URI(scheme, authenticationInfo, hostname, port, databaseName != null ? "/" + databaseName : null, null, null) .toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException( "Error constructing URI from Host:'" + hostname + "' and port:'" + port + "' and database name:'" + databaseName + "'!"); } }  @Override String getDriverClassNameForDatabase(DatabaseType databaseType); @Override String getDatabaseUrlForDatabase(DatabaseType databaseType, String hostname,
			int port, String databaseName);  }