@Test public void testDelete() throws DatabaseException { Project census = new Project("census", 2, 3, 4, 5); Project births = new Project("births", 6, 7, 8, 9); dbProjects.add(census); dbProjects.add(births); List<Project> all = dbProjects.getAll(); assertEquals(2, all.size()); dbProjects.delete(census); dbProjects.delete(births); all = dbProjects.getAll(); assertEquals(0, all.size()); }
@Test(expected = DatabaseException.class) public void testInvalidDelete() throws DatabaseException { Project invalidProject = new Project(null, -1, -1, -1, -1); dbProjects.delete(invalidProject); }