use of android.content.CursorLoader in project iosched by google.
the class SessionDetailModelTest method createCursorLoader_NullQuery_ReturnsNullCursor.
@Test
public void createCursorLoader_NullQuery_ReturnsNullCursor() {
// When ran with mock uri and null query loader id
CursorLoader createdCursorLoader = (CursorLoader) mSessionDetailModel.createCursorLoader(null, null);
// Then the returned cursor loader is null
assertThat(createdCursorLoader, nullValue());
}
use of android.content.CursorLoader in project iosched by google.
the class SessionDetailModelTest method createCursorLoader_SessionQuery_ReturnsCursorLoader.
@Test
public void createCursorLoader_SessionQuery_ReturnsCursorLoader() {
// Given a mock uri and mock cursor loader
SessionDetailModel spyModel = spy(new SessionDetailModel(mMockUri, mMockContext, mMockSessionsHelper, mMockLoaderManager));
doReturn(FAKE_ID).when(spyModel).getSessionId(mMockUri);
doReturn(mMockCursorLoader).when(spyModel).getCursorLoaderInstance(any(Context.class), any(Uri.class), any(String[].class), any(String.class), any(String[].class), any(String.class));
// When ran with mock uri and session query loader id
CursorLoader createdCursorLoader = (CursorLoader) spyModel.createCursorLoader(SessionDetailModel.SessionDetailQueryEnum.SESSIONS, null);
// Then the returned cursor loader is the mock cursor loader
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
use of android.content.CursorLoader in project iosched by google.
the class SessionDetailModelTest method createCursorLoader_FeedbackQuery_ReturnsCursor.
@Test
public void createCursorLoader_FeedbackQuery_ReturnsCursor() {
// Given a mock uri and mock cursor loader
SessionDetailModel spyModel = spy(new SessionDetailModel(mMockUri, mMockContext, mMockSessionsHelper, mMockLoaderManager));
doReturn(mMockUri).when(spyModel).getFeedbackUri(any(String.class));
doReturn(mMockCursorLoader).when(spyModel).getCursorLoaderInstance(any(Context.class), any(Uri.class), any(String[].class), any(String.class), any(String[].class), any(String.class));
// When ran with mock uri and feedback query loader id
CursorLoader createdCursorLoader = (CursorLoader) spyModel.createCursorLoader(SessionDetailModel.SessionDetailQueryEnum.FEEDBACK, null);
// Then the returned cursor loader is the mock cursor loader
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
use of android.content.CursorLoader in project iosched by google.
the class VideoLibraryModelTest method createCursorLoader_VideosQuery_Success.
@Test
public void createCursorLoader_VideosQuery_Success() {
// Given a mock cursor loader set up for a video query
// When ran with the video query
CursorLoader createdCursorLoader = (CursorLoader) mSpyModel.createCursorLoader(VideoLibraryModel.VideoLibraryQueryEnum.VIDEOS, null);
// Then the returned cursor loader is the same as the mock one
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
use of android.content.CursorLoader in project iosched by google.
the class VideoLibraryModelTest method createCursorLoader_FilteredVideosQuery_Success.
@Test
public void createCursorLoader_FilteredVideosQuery_Success() {
// Given a mock cursor loader set up for a video query
when(mMockBundle.containsKey(VideoLibraryModel.KEY_TOPIC)).thenReturn(true);
when(mMockBundle.containsKey(VideoLibraryModel.KEY_YEAR)).thenReturn(true);
when(mMockBundle.getString(VideoLibraryModel.KEY_TOPIC)).thenReturn("Android");
when(mMockBundle.getInt(VideoLibraryModel.KEY_YEAR)).thenReturn(2012);
// When ran with the video query
CursorLoader createdCursorLoader = (CursorLoader) mSpyModel.createCursorLoader(VideoLibraryModel.VideoLibraryQueryEnum.VIDEOS, mMockBundle);
// Then the returned cursor loader is the same as the mock one
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
Aggregations