Skip to content

Commit

Permalink
Add test for dialog fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed Mar 11, 2020
1 parent 8f2185e commit 337ad97
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.odk.collect.android.formentry;

import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.robolectric.Shadows.shadowOf;

@RunWith(RobolectricTestRunner.class)
public class FormLoadingDialogFragmentTest {

private FragmentManager fragmentManager;

@Before
public void setup() {
FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
fragmentManager = activity.getSupportFragmentManager();
}

@Test
public void dialogIsNotCancellable() {
FormLoadingDialogFragment fragment = new FormLoadingDialogFragment();
fragment.show(fragmentManager, "TAG");

assertThat(shadowOf(fragment.getDialog()).isCancelable(), equalTo(false));
}
}

0 comments on commit 337ad97

Please sign in to comment.