Added the missing test.

This commit is contained in:
Ali Dehghani 2019-05-13 00:14:49 +04:30
parent 4f8327e0b4
commit 8cab3f616e
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,28 @@
package com.baeldung;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.RegisterExtension;
import com.baeldung.extensions.EmployeeDatabaseSetupExtension;
public class MultipleExtensionsUnitTest {
@Order(1)
@RegisterExtension
static EmployeeDatabaseSetupExtension SECOND_DB =
new EmployeeDatabaseSetupExtension("jdbc:h2:mem:DbTwo;DB_CLOSE_DELAY=-1", "org.h2.Driver", "sa", "");
@Order(0)
@RegisterExtension
static EmployeeDatabaseSetupExtension FIRST_DB =
new EmployeeDatabaseSetupExtension("jdbc:h2:mem:DbOne;DB_CLOSE_DELAY=-1", "org.h2.Driver", "sa", "");
@RegisterExtension
static EmployeeDatabaseSetupExtension LAST_DB =
new EmployeeDatabaseSetupExtension("jdbc:h2:mem:DbLast;DB_CLOSE_DELAY=-1", "org.h2.Driver", "sa", "");
@Test
public void justDemonstratingTheIdea() {
// empty test
}
}

View File

@ -19,7 +19,7 @@ public class EmployeeJdbcDao {
}
public void createTable() throws SQLException {
String createQuery = "CREATE TABLE employees(id long primary key, firstName varchar(50))";
String createQuery = "CREATE TABLE IF NOT EXISTS employees(id long primary key, firstName varchar(50))";
PreparedStatement pstmt = con.prepareStatement(createQuery);
pstmt.execute();