Skip to content

Commit

Permalink
JDBC-201 convert a simple test to JUnit 4 to test JUnit 4 base class
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed Aug 6, 2012
1 parent f558638 commit 358e024
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/test/org/firebirdsql/common/FBJUnit4TestBase.java
Expand Up @@ -56,7 +56,7 @@ public void basicSetUp() throws Exception {
* @throws Exception
*/
@After
protected void basicTearDown() throws Exception {
public void basicTearDown() throws Exception {
defaultDatabaseTearDown(fbManager);
fbManager = null;
}
Expand Down
29 changes: 16 additions & 13 deletions src/test/org/firebirdsql/jdbc/TestFBSavepoint.java
Expand Up @@ -20,28 +20,29 @@

import java.sql.*;

import org.firebirdsql.common.FBTestBase;
import org.firebirdsql.common.FBJUnit4TestBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.firebirdsql.common.FBTestProperties.*;
import static org.junit.Assert.*;

/**
* Tests for savepoint handling.
*
* @author <a href="mailto:rrokytskyy@users.sourceforge.net">Roman Rokytskyy</a>
*/
public class TestFBSavepoint extends FBTestBase {
public class TestFBSavepoint extends FBJUnit4TestBase {


private FirebirdConnection connection;

public TestFBSavepoint(String name) {
super(name);
}

protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() throws Exception {

Class.forName(FBDriver.class.getName());

connection = (FirebirdConnection)getConnectionViaDriverManager();
connection = getConnectionViaDriverManager();

Statement stmt = connection.createStatement();
try {
Expand All @@ -59,7 +60,8 @@ protected void setUp() throws Exception {
}
}

protected void tearDown() throws Exception {
@After
public void tearDown() throws Exception {

Statement stmt = connection.createStatement();

Expand All @@ -72,15 +74,14 @@ protected void tearDown() throws Exception {
}

connection.close();

super.tearDown();
}

/**
* Test if basic savepoint handling works.
*
* @throws Exception if something went wrong.
*/
@Test
public void testBasicSavepoint() throws Exception {

connection.setAutoCommit(true);
Expand Down Expand Up @@ -128,6 +129,7 @@ public void testBasicSavepoint() throws Exception {
*
* @throws Exception if something went wrong.
*/
@Test
public void testNamedSavepoint() throws Exception {

connection.setAutoCommit(false);
Expand Down Expand Up @@ -175,6 +177,7 @@ public void testNamedSavepoint() throws Exception {
*
* @throws Exception if something went wrong.
*/
@Test
public void testSavepointRelease() throws Exception {
connection.setAutoCommit(false);

Expand Down

0 comments on commit 358e024

Please sign in to comment.