/** * Clean data of test * * @throws SQLException * @throws ClassNotFoundException */ @After public void cleanData() throws SQLException, ClassNotFoundException, UnavailableDataException { IndexDAO indexDAO = new IndexDAO(); List<Index> indexes = indexDAO.getIndexes(); for (Index index : indexes) { indexDAO.eraseIndex(index); } indexDAO.closeConnection(); File dirDB = new File("data" + File.separator + "db"); for (File file : dirDB.listFiles()) { file.delete(); } dirDB.delete(); File dirJSON = new File("data" + File.separator + "anime"); if (dirJSON.exists()) { for (File file : dirJSON.listFiles()) { file.delete(); } } dirJSON.delete(); } // end of the method cleanData