コード例 #1
0
  @After
  public void tearDown() throws Exception {

    // Roll back transaction so changes to database are undone
    db.endTransaction(false);

    db = null;
    dbProjects = null;
  }
コード例 #2
0
  @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();
  }
コード例 #3
0
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {

    // Load database driver
    Database.initialize();
  }