@Test public void connects_via_the_provided_uri() { Connection expectedConnection = mock(Connection.class); Supplier<Connection> connectionProvider = new ConnectionConfigurationByUri( "jdbc:neo4j:mem:mydb", Optional.empty(), Optional.empty(), Optional.empty(), new MockedConnectionSupplier(expectedConnection) ); Connection connection = connectionProvider.get(); assertThat(connection).isSameAs(expectedConnection); }
@Override public Connection get() { return connectionSupplier.getConnection(uri, properties); }
ConnectionConfigurationByUri implements ConnectionConfiguration { @Override public Connection get() { return connectionSupplier.getConnection(uri, properties); } }
ConnectionConfigurationByUri implements ConnectionConfiguration { @Override public Connection get() { return connectionSupplier.getConnection(uri, properties); } ConnectionConfigurationByUri(String uri,
                                        Optional<String> database,
                                        Optional<String> username,
                                        Optional<String> password);   ConnectionConfigurationByUri(String uri,
                                 Optional<String> database,
                                 Optional<String> username,
                                 Optional<String> password,
                                 UriConnectionSupplier connectionSupplier); }
ConnectionConfigurationByUri implements ConnectionConfiguration { @Override public Connection get() { return connectionSupplier.getConnection(uri, properties); } ConnectionConfigurationByUri(String uri,
                                        Optional<String> database,
                                        Optional<String> username,
                                        Optional<String> password);   ConnectionConfigurationByUri(String uri,
                                 Optional<String> database,
                                 Optional<String> username,
                                 Optional<String> password,
                                 UriConnectionSupplier connectionSupplier); @Override Connection get(); }
ConnectionConfigurationByUri implements ConnectionConfiguration { @Override public Connection get() { return connectionSupplier.getConnection(uri, properties); } ConnectionConfigurationByUri(String uri,
                                        Optional<String> database,
                                        Optional<String> username,
                                        Optional<String> password);   ConnectionConfigurationByUri(String uri,
                                 Optional<String> database,
                                 Optional<String> username,
                                 Optional<String> password,
                                 UriConnectionSupplier connectionSupplier); @Override Connection get();  }