@Test public void addComicToRepository() { ComicDataSource comicDataSource = mock(ComicDataSource.class); ComicRespositoryImp comicRespositoryImp = new ComicRespositoryImp(comicDataSource); Comic comic = mock(Comic.class); when(comic.getId()).thenReturn("1"); comicRespositoryImp.addComic(comic); assertTrue(comicRespositoryImp.getAllComics().size() > 0); }
@Test public void deleteComic() { ComicDataSource comicDataSource = mock(ComicDataSource.class); ComicRespositoryImp comicRespositoryImp = new ComicRespositoryImp(comicDataSource); Comic comic = mock(Comic.class); when(comic.getId()).thenReturn("1"); comicRespositoryImp.addComic(comic); comicRespositoryImp.deleteComic("1"); assertTrue(comicRespositoryImp.getComic("1") == null); }