/** * Assert "Given I select the anime "Bleach"" * * @param title Bleach * @throws Throwable */ @Given("^I select the anime \"(.*?)\"$") public void i_select_the_anime(String title) throws Throwable { Index index = new Index(title, 46); Anime anime = new Anime(); anime.setCodeAnime(46); anime.setCurrentEpisode(0); IndexDAO indexDAO = new IndexDAO(); indexRegistered = indexDAO.addIndex(index); AnimeDAO animeDAO = new AnimeDAO(); animeDAO.createAnime(anime); animeRegistered = anime; mainController = new MainController(); } // end of the method i_select_the_anime
/** * 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
/** * Assert "Then I shouldn't see the anime "Bleach"" * * @param arg1 * @throws Throwable */ @Then("^I shouldn't see the anime \"(.*?)\"$") public void i_shouldn_t_see_the_anime(String arg1) throws Throwable { IndexDAO indexDAO = new IndexDAO(); assertThat(indexDAO.getIndexes().size(), is(0)); } // end of the method i_shouldn_t_see_the_anime