@Test
 public void setRouteTo_failureShouldDismissLoadingDialogUpon() throws Exception {
   fragment.createRouteToDestination();
   fragment.failure(500);
   assertThat(activity.getMapFragment().getView().findViewById(R.id.map)).isVisible();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isNotVisible();
 }
 @Test
 public void setRouteTo_successShouldDismissLoadingDialogUpon() throws Exception {
   fragment.createRouteToDestination();
   fragment.success(new Route(getFixture("around_the_block")));
   assertThat(activity.getMapFragment().getView().findViewById(R.id.map)).isVisible();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isNotVisible();
 }
 @Test
 public void reverse_shouldToggleCircleButtonToStart() throws Exception {
   fragment.createRouteToDestination();
   Route testRoute = new Route(getFixture("around_the_block"));
   fragment.success(testRoute);
   fragment.reverse();
   fragment.reverse();
   assertThat(fragment.routingCircle.getTag()).isEqualTo(activity.getString(R.string.start));
 }
 @Test
 public void start_shouldStartRouting() throws Exception {
   fragment.createRouteToDestination();
   Route testRoute = new Route(getFixture("around_the_block"));
   fragment.success(testRoute);
   ImageButton startBtn = (ImageButton) fragment.getView().findViewById(R.id.routing_circle);
   startBtn.performClick();
   assertThat(activity.getSupportFragmentManager()).hasFragmentWithTag(RouteFragment.TAG);
 }
 @Before
 public void setup() throws Exception {
   ((TestMapzenApplication) Robolectric.application).inject(this);
   MockitoAnnotations.initMocks(this);
   activity = initBaseActivity();
   activity.disableActionbar();
   destination = getTestSimpleFeature();
   fragment = RoutePreviewFragment.newInstance(activity, destination);
   TestHelper.startFragment(fragment, activity);
 }
 @Test
 public void onResume_shouldNotCreateRouteToDestinationIfRouting() throws Exception {
   activity
       .getSupportFragmentManager()
       .beginTransaction()
       .add(new Fragment(), RouteFragment.TAG)
       .commit();
   fragment.onResume();
   verify(router, times(1)).fetch();
 }
 @Test
 public void onViewCreated_shouldHideActionBar() throws Exception {
   activity.getSupportActionBar().show();
   fragment.onViewCreated(fragment.getView(), null);
   assertThat(activity.getSupportActionBar().isShowing()).isFalse();
 }
 @Test
 public void onDetach_shouldShowActionbar() throws Exception {
   fragment.onDetach();
   assertThat(activity.actionBarIsEnabled()).isTrue();
   assertThat(activity.getSupportActionBar().isShowing()).isTrue();
 }
 @Test
 public void onStart_shouldHideActionbar() throws Exception {
   assertThat(activity.getSupportActionBar().isShowing()).isFalse();
 }
Esempio n. 10
0
 @Test
 public void setRouteTo_shouldShowLoadingDialog() throws Exception {
   fragment.createRouteToDestination();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isVisible();
 }