Ejemplo n.º 1
0
  @Test
  public void testPostsShowAndAreScrollableInFeed() {
    List<Long> postIdList = MockModelsUtil.createMockPostIdList(20);
    List<Post> postList = new ArrayList<>();
    for (Long id : postIdList) {
      postList.add(MockModelsUtil.createMockStoryWithId(id));
    }

    stubMockPosts(postIdList, postList);
    main.launchActivity(null);

    checkPostsDisplayOnRecyclerView(postList);
  }
Ejemplo n.º 2
0
  @Test
  public void testJobPostHasViewButton() throws Exception {
    List<Long> postIdList = new ArrayList<>();
    Post mockPost = MockModelsUtil.createMockJobWithTitle("Post with url");
    postIdList.add(mockPost.id);
    when(component.getMockHackerNewsService().getTopStories())
        .thenReturn(Observable.just(postIdList));
    when(component.getMockHackerNewsService().getStoryItem(mockPost.id.toString()))
        .thenReturn(Observable.just(mockPost));

    Intent i = new Intent(MainActivity.getStartIntent(InstrumentationRegistry.getTargetContext()));
    main.launchActivity(i);
    onView(withId(R.id.text_view_post)).check(matches(isDisplayed()));
  }
 @Before
 public void setUp() {
   mContext = RuntimeEnvironment.application;
   mPost = MockModelsUtil.createMockStory();
   mPostViewModel = new PostViewModel(mContext, mPost, false);
 }