Esempio n. 1
0
 /** tests the insertPodcast functionality */
 public void testInsertPodcast() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   int countBeforeInsert = pdao.getAllPodcasts().size();
   p1 = pdao.insertPodcast(p1);
   int countAfterInsert = pdao.getAllPodcasts().size();
   assertEquals(countBeforeInsert + 1, countAfterInsert);
   assertTrue(p1.getId() > 0);
 }
Esempio n. 2
0
 /** tests the getpodcastbyurl functionality */
 public void testGetPodcastByUrl() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   String url = "supergeileurl";
   p1.setUrl(url);
   pdao.insertPodcast(p1);
   Podcast nw = pdao.getPodcastByUrl(url);
   assertEquals(url, nw.getUrl());
 }
Esempio n. 3
0
 /** tests the updateLogoFilePath functionality */
 public void testUpdateLogoFilePath() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   p1 = pdao.insertPodcast(p1);
   String newFilePath = "new path haha";
   p1.setLogoFilePath(newFilePath);
   assertEquals(1, pdao.updateLogoFilePath(p1));
   Podcast pod = pdao.getPodcastById(p1.getId());
   assertEquals(newFilePath, pod.getLogoFilePath());
 }
Esempio n. 4
0
 /** tests the updateLastUpdate functionality */
 public void testUpdateLastUpdate() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   p1 = pdao.insertPodcast(p1);
   long currentMilis = System.currentTimeMillis();
   p1.setLastUpdate(currentMilis);
   assertEquals(1, pdao.updateLastUpdate(p1));
   Podcast pod = pdao.getPodcastById(p1.getId());
   assertEquals(currentMilis, pod.getLastUpdate());
 }
Esempio n. 5
0
 /** tests the getPodcastById functionality */
 public void testGetPodcastById() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   p1.setTitle("expected title");
   p1 = pdao.insertPodcast(p1);
   Podcast pod = pdao.getPodcastById(p1.getId());
   assertEquals("expected title", pod.getTitle());
   assertEquals(p1.getLastUpdate(), pod.getLastUpdate());
   assertEquals(p1.hashCode(), pod.hashCode());
 }
Esempio n. 6
0
 /** tests the deletePodcast functionality */
 public void testDeletePodcast() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   p1 = pdao.insertPodcast(p1);
   int countBeforeDelete = pdao.getAllPodcasts().size();
   int ret = pdao.deletePodcast(p1);
   int countAfterDelete = pdao.getAllPodcasts().size();
   assertEquals(1, ret);
   assertNotSame(countBeforeDelete, countAfterDelete);
 }
Esempio n. 7
0
 /** tests insert podcast functionality with trying to insert null on a non nullable column */
 public void testInsertNotNullableColumnShouldFail() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   p1.setUrl(null);
   Podcast pod = pdao.insertPodcast(p1);
   assertNull(pod);
 }
Esempio n. 8
0
 /** test the getAllPodcast functionality */
 public void testGetAllPodcasts() {
   PodcastDAOImpl dao = PodcastDAOImpl.i(this.mContext);
   assertNotNull("List of podcasts shouldn't be null", dao.getAllPodcasts());
 }
Esempio n. 9
0
 /** tests insert podcast functionality with inserting null on a nullable column */
 public void testInsertNullOnNullableColumn() {
   PodcastDAOImpl pdao = PodcastDAOImpl.i(this.mContext);
   p1.setLogoFilePath(null);
   Podcast pod = pdao.insertPodcast(p1);
   assertNotNull(pod);
 }