@Test public void shouldDeleteDataOnDatabase() throws SQLException { this.insertDefaultTestData(); int beforeDeleteCount = crudModel.count("artigos"); crudModel.delete("artigos", 1); assertEquals(beforeDeleteCount - 1, crudModel.count("artigos")); }
@Test public void shouldCountAndInsertDataOnDatabase() throws SQLException { int initialCount = crudModel.count("artigos"); this.insertDefaultTestData(); assertEquals(initialCount + 1, crudModel.count("artigos")); this.insertDefaultTestData(); assertEquals(initialCount + 2, crudModel.count("artigos")); }
@Test public void shouldSelectDataOnDatabase() throws SQLException { this.insertDefaultTestData(); ArrayList<String> fields = new ArrayList<String>(); int count = crudModel.count("artigos"); fields.add("id"); fields.add("internacionais"); fields.add("nacionais"); fields.add("locais"); ArrayList<Hashtable<String, String>> data = crudModel.select("artigos", fields); assertEquals(count, data.size()); }