Search in sources :

Example 1 with PhotoDetailsUiFragment

use of com.trovebox.android.app.PhotoDetailsActivity.PhotoDetailsUiFragment in project mobile-android by photo.

the class PhotoDetailsActivityTest method testPreconditions.

public void testPreconditions() throws JSONException, ClientProtocolException, IllegalStateException, IOException {
    // Setup mock calls and their responses
    PowerMock.reset(getApiMock());
    getApiMock().getPhoto((String) EasyMock.anyObject(), (ReturnSizes) EasyMock.anyObject(), (String) EasyMock.anyObject(), (String) EasyMock.anyObject());
    PowerMock.expectLastCall().andReturn(new PhotoResponse(RequestType.UNKNOWN, JSONUtils.getJson(getInstrumentation().getContext(), R.raw.json_photo_get))).times(2);
    PowerMock.replayAll();
    Intent intent = new Intent();
    Photo photo = Photo.fromJson(JSONUtils.getJson(getInstrumentation().getContext(), R.raw.json_photo));
    intent.putExtra(PhotoDetailsUiFragment.EXTRA_PHOTO, photo);
    setActivityIntent(intent);
    activity = this.getActivity();
    Fragment fragment = activity.getSupportFragmentManager().findFragmentById(android.R.id.content);
    Assert.assertNotNull(fragment);
    Assert.assertTrue(fragment instanceof PhotoDetailsUiFragment);
}
Also used : PhotoResponse(com.trovebox.android.common.net.PhotoResponse) PhotoDetailsUiFragment(com.trovebox.android.app.PhotoDetailsActivity.PhotoDetailsUiFragment) Intent(android.content.Intent) Photo(com.trovebox.android.common.model.Photo) Fragment(android.support.v4.app.Fragment) PhotoDetailsUiFragment(com.trovebox.android.app.PhotoDetailsActivity.PhotoDetailsUiFragment)

Aggregations

Intent (android.content.Intent)1 Fragment (android.support.v4.app.Fragment)1 PhotoDetailsUiFragment (com.trovebox.android.app.PhotoDetailsActivity.PhotoDetailsUiFragment)1 Photo (com.trovebox.android.common.model.Photo)1 PhotoResponse (com.trovebox.android.common.net.PhotoResponse)1