use of com.quran.data.page.provider.madani.MadaniPageProvider in project quran_android by quran.
the class ArabicDatabaseUtilsTest method testHydrateAyahTextEmpty.
@Test
public void testHydrateAyahTextEmpty() {
ArabicDatabaseUtils arabicDatabaseUtils = new ArabicDatabaseUtils(context, new QuranInfo(new MadaniPageProvider()), mock(QuranFileUtils.class)) {
@Override
DatabaseHandler getArabicDatabaseHandler() {
return arabicHandler;
}
@Override
Map<Integer, String> getAyahTextForAyat(List<Integer> ayat) {
Map<Integer, String> result = new HashMap<>();
for (Integer ayahId : ayat) {
result.put(ayahId, "verse " + ayahId);
}
return result;
}
};
List<Bookmark> bookmarks = new ArrayList<>(1);
bookmarks.add(new Bookmark(1, null, null, 3));
List<Bookmark> result = arabicDatabaseUtils.hydrateAyahText(bookmarks);
assertThat(result).hasSize(1);
assertThat(result.get(0)).isNotInstanceOf(BookmarkWithAyahText.class);
assertThat(result.get(0).getAyahText()).isNull();
assertThat(result).isSameAs(bookmarks);
}
use of com.quran.data.page.provider.madani.MadaniPageProvider in project quran_android by quran.
the class ArabicDatabaseUtilsTest method testHydrateAyahText.
@Test
public void testHydrateAyahText() {
ArabicDatabaseUtils arabicDatabaseUtils = new ArabicDatabaseUtils(context, new QuranInfo(new MadaniPageProvider()), mock(QuranFileUtils.class)) {
@Override
DatabaseHandler getArabicDatabaseHandler() {
return arabicHandler;
}
@Override
Map<Integer, String> getAyahTextForAyat(List<Integer> ayat) {
Map<Integer, String> result = new HashMap<>();
for (Integer ayahId : ayat) {
result.put(ayahId, "verse " + ayahId);
}
return result;
}
};
List<Bookmark> bookmarks = new ArrayList<>(3);
bookmarks.add(new Bookmark(1, 1, 1, 1));
bookmarks.add(new Bookmark(2, null, null, 3));
bookmarks.add(new Bookmark(3, 114, 6, 604));
List<Bookmark> result = arabicDatabaseUtils.hydrateAyahText(bookmarks);
assertThat(result).hasSize(3);
assertThat(result.get(0)).isInstanceOf(BookmarkWithAyahText.class);
assertThat(result.get(1)).isNotInstanceOf(BookmarkWithAyahText.class);
assertThat(result.get(2)).isInstanceOf(BookmarkWithAyahText.class);
assertThat(result.get(0).getAyahText()).isNotEmpty();
assertThat(result.get(1).getAyahText()).isNull();
assertThat(result.get(0).getAyahText()).isNotEmpty();
assertThat(result).isNotSameAs(bookmarks);
}
Aggregations