Added a new constructor for employee extension.
This commit is contained in:
parent
104b0d597f
commit
97022ca7d3
@ -15,10 +15,20 @@ import com.baeldung.helpers.JdbcConnectionUtil;
|
|||||||
|
|
||||||
public class EmployeeDatabaseSetupExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback {
|
public class EmployeeDatabaseSetupExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback {
|
||||||
|
|
||||||
private Connection con = JdbcConnectionUtil.getConnection();
|
private Connection con;
|
||||||
private EmployeeJdbcDao employeeDao = new EmployeeJdbcDao(con);
|
private EmployeeJdbcDao employeeDao;
|
||||||
private Savepoint savepoint;
|
private Savepoint savepoint;
|
||||||
|
|
||||||
|
public EmployeeDatabaseSetupExtension() {
|
||||||
|
con = JdbcConnectionUtil.getConnection();
|
||||||
|
employeeDao = new EmployeeJdbcDao(con);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmployeeDatabaseSetupExtension(String jdbcUrl, String driver, String username, String password) {
|
||||||
|
con = JdbcConnectionUtil.getConnection(jdbcUrl, driver, username, password);
|
||||||
|
employeeDao = new EmployeeJdbcDao(con);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterAll(ExtensionContext context) throws SQLException {
|
public void afterAll(ExtensionContext context) throws SQLException {
|
||||||
if (con != null) {
|
if (con != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user