Skip to content

Commit

Permalink
Added a comment to the builder class
Browse files Browse the repository at this point in the history
  • Loading branch information
zapodot committed Jan 13, 2015
1 parent 34f19d8 commit 0489948
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/main/java/org/zapodot/junit/db/EmbeddedDatabaseRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/
public class EmbeddedDatabaseRule implements TestRule {

/**
* A builder class that provides a fluent api for building DB rules
*/
public static class Builder {

private Map<String, String> properties = new LinkedHashMap<>();
Expand Down Expand Up @@ -119,7 +122,7 @@ public Connection getConnection() {
* @return a DataSource instance wrapping a single connection
*/
public DataSource getDataSource() {
return new EmbeddedDataSource(getConnection());
return EmbeddedDataSource.create(getConnection());
}

public boolean isAutoCommit() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.zapodot.junit.db.internal;

import org.zapodot.junit.db.internal.CloseSuppressedConnectionFactory;

import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
Expand All @@ -16,10 +14,14 @@ public class EmbeddedDataSource implements DataSource {

private final Connection connection;

public EmbeddedDataSource(final Connection connection) {
private EmbeddedDataSource(final Connection connection) {
this.connection = connection;
}

public static EmbeddedDataSource create(final Connection connection) {
return new EmbeddedDataSource(connection);
}

@Override
public Connection getConnection() throws SQLException {
return CloseSuppressedConnectionFactory.createProxy(connection);
Expand Down

0 comments on commit 0489948

Please sign in to comment.