// Path: app/src/main/java/com/nilhcem/devoxxfr/ui/schedule/pager/SchedulePagerFragment.java
// @FragmentWithArgs
// public class SchedulePagerFragment extends BaseFragment<SchedulePagerPresenter> implements SchedulePagerView {
// 
//     @Arg boolean allSessions;
// 
//     @Inject DataProvider dataProvider;
// 
//     @Bind(R.id.schedule_loading) ProgressBar loading;
//     @Bind(R.id.schedule_viewpager) ViewPager viewPager;
// 
//     private Snackbar errorSnackbar;
// 
//     @Override
//     protected SchedulePagerPresenter newPresenter() {
//         return new SchedulePagerPresenter(this, dataProvider);
//     }
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         DevoxxApp.get(getContext()).component().inject(this);
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         return inflater.inflate(R.layout.schedule_pager, container, false);
//     }
// 
//     @Override
//     public void onDestroyView() {
//         if (errorSnackbar != null) {
//             errorSnackbar.dismiss();
//         }
//         super.onDestroyView();
//     }
// 
//     @Override
//     public void displaySchedule(Schedule schedule) {
//         viewPager.setAdapter(new SchedulePagerAdapter(getContext(), getChildFragmentManager(), schedule, allSessions));
//         if (schedule.size() > 1) {
//             ((DrawerActivity) getActivity()).setupTabLayoutWithViewPager(viewPager);
//         }
// 
//         loading.setVisibility(View.GONE);
//         viewPager.setVisibility(View.VISIBLE);
//     }
// 
//     @Override
//     public void displayLoadingError() {
//         loading.setVisibility(View.GONE);
//         errorSnackbar = Snackbar.make(loading, R.string.connection_error, Snackbar.LENGTH_INDEFINITE)
//                 .setAction(R.string.connection_error_retry, v -> presenter.reloadData());
//         errorSnackbar.show();
//     }
// }
// 
// Path: app/src/main/java/com/nilhcem/devoxxfr/ui/speakers/list/SpeakersListFragment.java
// public class SpeakersListFragment extends BaseFragment<SpeakersListPresenter> implements SpeakersListView {
// 
//     @Inject Picasso picasso;
//     @Inject DataProvider dataProvider;
// 
//     @Bind(R.id.speakers_list_loading) ProgressBar loading;
//     @Bind(R.id.speakers_list_recyclerview) RecyclerView recyclerView;
// 
//     private Snackbar errorSnackbar;
//     private SpeakersListAdapter adapter;
// 
//     @Override
//     protected SpeakersListPresenter newPresenter() {
//         return new SpeakersListPresenter(this, dataProvider);
//     }
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         DevoxxApp.get(getContext()).component().inject(this);
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         return inflater.inflate(R.layout.speakers_list, container, false);
//     }
// 
//     @Override
//     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//         super.onViewCreated(view, savedInstanceState);
//         adapter = new SpeakersListAdapter(picasso, this);
//         recyclerView.addItemDecoration(new MarginDecoration(getContext()));
//         recyclerView.setHasFixedSize(true);
//         recyclerView.setAdapter(adapter);
//     }
// 
//     @Override
//     public void onDestroyView() {
//         if (errorSnackbar != null) {
//             errorSnackbar.dismiss();
//         }
//         super.onDestroyView();
//     }
// 
//     @Override
//     public void displaySpeakers(List<Speaker> speakers) {
//         adapter.setSpeakers(speakers);
//         loading.setVisibility(View.GONE);
//         recyclerView.setVisibility(View.VISIBLE);
//     }
// 
//     @Override
//     public void displayLoadingError() {
//         loading.setVisibility(View.GONE);
//         errorSnackbar = Snackbar.make(loading, R.string.connection_error, Snackbar.LENGTH_INDEFINITE)
//                 .setAction(R.string.connection_error_retry, v -> presenter.reloadData());
//         errorSnackbar.show();
//     }
// 
//     @Override
//     public void showSpeakerDetails(Speaker speaker) {
//         SpeakerDetailsDialogFragment.show(speaker, getFragmentManager());
//     }
// }


import android.os.Build;
import com.nilhcem.devoxxfr.BuildConfig;
import com.nilhcem.devoxxfr.R;
import com.nilhcem.devoxxfr.ui.schedule.pager.SchedulePagerFragment;
import com.nilhcem.devoxxfr.ui.speakers.list.SpeakersListFragment;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
package com.nilhcem.devoxxfr.ui.drawer;





@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
public class DrawerPresenterTest {

    @Mock DrawerActivityView view;
    private DrawerPresenter presenter;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        presenter = new DrawerPresenter(view);
    }

    @Test
    public void should_automatically_select_my_schedule_when_starting_the_app() {
        // When
        presenter.onPostCreate(null);

        // Then
// Path: app/src/main/java/com/nilhcem/devoxxfr/ui/schedule/pager/SchedulePagerFragment.java
// @FragmentWithArgs
// public class SchedulePagerFragment extends BaseFragment<SchedulePagerPresenter> implements SchedulePagerView {
// 
//     @Arg boolean allSessions;
// 
//     @Inject DataProvider dataProvider;
// 
//     @Bind(R.id.schedule_loading) ProgressBar loading;
//     @Bind(R.id.schedule_viewpager) ViewPager viewPager;
// 
//     private Snackbar errorSnackbar;
// 
//     @Override
//     protected SchedulePagerPresenter newPresenter() {
//         return new SchedulePagerPresenter(this, dataProvider);
//     }
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         DevoxxApp.get(getContext()).component().inject(this);
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         return inflater.inflate(R.layout.schedule_pager, container, false);
//     }
// 
//     @Override
//     public void onDestroyView() {
//         if (errorSnackbar != null) {
//             errorSnackbar.dismiss();
//         }
//         super.onDestroyView();
//     }
// 
//     @Override
//     public void displaySchedule(Schedule schedule) {
//         viewPager.setAdapter(new SchedulePagerAdapter(getContext(), getChildFragmentManager(), schedule, allSessions));
//         if (schedule.size() > 1) {
//             ((DrawerActivity) getActivity()).setupTabLayoutWithViewPager(viewPager);
//         }
// 
//         loading.setVisibility(View.GONE);
//         viewPager.setVisibility(View.VISIBLE);
//     }
// 
//     @Override
//     public void displayLoadingError() {
//         loading.setVisibility(View.GONE);
//         errorSnackbar = Snackbar.make(loading, R.string.connection_error, Snackbar.LENGTH_INDEFINITE)
//                 .setAction(R.string.connection_error_retry, v -> presenter.reloadData());
//         errorSnackbar.show();
//     }
// }
// 
// Path: app/src/main/java/com/nilhcem/devoxxfr/ui/speakers/list/SpeakersListFragment.java
// public class SpeakersListFragment extends BaseFragment<SpeakersListPresenter> implements SpeakersListView {
// 
//     @Inject Picasso picasso;
//     @Inject DataProvider dataProvider;
// 
//     @Bind(R.id.speakers_list_loading) ProgressBar loading;
//     @Bind(R.id.speakers_list_recyclerview) RecyclerView recyclerView;
// 
//     private Snackbar errorSnackbar;
//     private SpeakersListAdapter adapter;
// 
//     @Override
//     protected SpeakersListPresenter newPresenter() {
//         return new SpeakersListPresenter(this, dataProvider);
//     }
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         DevoxxApp.get(getContext()).component().inject(this);
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         return inflater.inflate(R.layout.speakers_list, container, false);
//     }
// 
//     @Override
//     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//         super.onViewCreated(view, savedInstanceState);
//         adapter = new SpeakersListAdapter(picasso, this);
//         recyclerView.addItemDecoration(new MarginDecoration(getContext()));
//         recyclerView.setHasFixedSize(true);
//         recyclerView.setAdapter(adapter);
//     }
// 
//     @Override
//     public void onDestroyView() {
//         if (errorSnackbar != null) {
//             errorSnackbar.dismiss();
//         }
//         super.onDestroyView();
//     }
// 
//     @Override
//     public void displaySpeakers(List<Speaker> speakers) {
//         adapter.setSpeakers(speakers);
//         loading.setVisibility(View.GONE);
//         recyclerView.setVisibility(View.VISIBLE);
//     }
// 
//     @Override
//     public void displayLoadingError() {
//         loading.setVisibility(View.GONE);
//         errorSnackbar = Snackbar.make(loading, R.string.connection_error, Snackbar.LENGTH_INDEFINITE)
//                 .setAction(R.string.connection_error_retry, v -> presenter.reloadData());
//         errorSnackbar.show();
//     }
// 
//     @Override
//     public void showSpeakerDetails(Speaker speaker) {
//         SpeakerDetailsDialogFragment.show(speaker, getFragmentManager());
//     }
// }


// Path: app/src/test/java/com/nilhcem/devoxxfr/ui/drawer/DrawerPresenterTest.java
import android.os.Build;
import com.nilhcem.devoxxfr.BuildConfig;
import com.nilhcem.devoxxfr.R;
import com.nilhcem.devoxxfr.ui.schedule.pager.SchedulePagerFragment;
import com.nilhcem.devoxxfr.ui.speakers.list.SpeakersListFragment;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

package com.nilhcem.devoxxfr.ui.drawer;





@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
public class DrawerPresenterTest {

    @Mock DrawerActivityView view;
    private DrawerPresenter presenter;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        presenter = new DrawerPresenter(view);
    }

    @Test
    public void should_automatically_select_my_schedule_when_starting_the_app() {
        // When
        presenter.onPostCreate(null);

        // Then
        verify(view).showFragment(any(SchedulePagerFragment.class));