    @Test
    public void loadPostsError() throws Exception {

        String errorText = "Error!";

        mPresenter.loadPosts();

        // Data should be loaded from data source and loading indicator should be displayed
        verify(mData).getPosts(mGetPostsCallbackbackCaptor.capture());
        verify(mView).setLoadingPosts(true);

        // Trigger error
        mGetPostsCallbackbackCaptor.getValue().onPostsNotAvailable(errorText, null);

        // Loading indicator should be hidden and error should be displayed.
        verify(mView).setLoadingPosts(false);
        verify(mView).showError(anyString(), anyString());
        verify(mView).showNoPostsMessage(true);
        verify(mView).setPosts(null);

    }