@After public void tearDown() throws Exception { // Roll back transaction so changes to database are undone db.endTransaction(false); db = null; dbProjects = null; }
@Before public void setUp() throws Exception { // Delete all projects from the database db = new Database(); db.startTransaction(); db.getProjectsDAO().dropTable(); db.getProjectsDAO().createTable(); List<Project> projects = db.getProjectsDAO().getAll(); // for (Project p : projects) { // db.getProjectsDAO().delete(p); // } db.endTransaction(true); // Prepare database for test case db = new Database(); db.startTransaction(); dbProjects = db.getProjectsDAO(); }
@BeforeClass public static void setUpBeforeClass() throws Exception { // Load database driver Database.initialize(); }