use of org.edx.mobile.model.db.DownloadEntry.DownloadedState in project edx-app-android by edx.
the class DbTests method testgetDownloadedStateForVideoId.
@Test
public void testgetDownloadedStateForVideoId() throws Exception {
db.clearDataByUser(username);
String videoId = "videoId";
db.getDownloadedStateForVideoId(videoId, new DataCallback<DownloadEntry.DownloadedState>() {
@Override
public void onResult(DownloadedState result) {
assertTrue(result == DownloadedState.ONLINE);
print("Result for getDownloadedStateForVideoId for not downloaded" + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.videoId = "videoId-" + System.currentTimeMillis();
de.downloaded = DownloadedState.DOWNLOADED;
db.addVideoData(de, null);
db.getDownloadedStateForVideoId(de.videoId, new DataCallback<DownloadEntry.DownloadedState>() {
@Override
public void onResult(DownloadedState result) {
assertNotNull(result);
assertTrue(result == DownloadedState.DOWNLOADED);
print("Result for getDownloadedStateForVideoId for downloaded is" + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
Aggregations