@Test public void testDelete() { Player result = playerDAO.createPlayer(player); assertNotNull(result); playerDAO.deletePlayer(result); Player deleted = playerDAO.getPlayerById(result.getId()); assertNull(deleted); }
@Test public void testUpdate() { Player result = playerDAO.createPlayer(player); result.setName("New Name"); Player updated = playerDAO.updatePlayer(result); assertEquals("New Name", updated.getName()); assertEquals(result.getId(), updated.getId()); }
@Override public void tearDown() throws Exception { super.tearDown(); playerDAO.close(); SQLiteHelper sqLiteHelper = new SQLiteHelper(context); sqLiteHelper.truncateTables(); sqLiteHelper.close(); }
@Override public void setUp() throws Exception { super.setUp(); playerDAO = new PlayerDAO(context); playerDAO.open(); // add team to db team = DatabaseUtil.addTeamToDatabase(context, "Test Team"); player = new Player(); player.setName("Test Person"); player.setTeam(team); }
@Test public void testInsert() { Player result = playerDAO.createPlayer(player); assertEquals("Test Person", result.getName()); assertNotNull(result.getId()); }