react-native-navigation的迁移库

BaseTest.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.reactnativenavigation;
  2. import android.app.*;
  3. import android.support.v7.app.*;
  4. import android.view.*;
  5. import org.junit.*;
  6. import org.junit.runner.*;
  7. import org.robolectric.*;
  8. import org.robolectric.annotation.*;
  9. import static org.assertj.core.api.Java6Assertions.*;
  10. @RunWith(RobolectricTestRunner.class)
  11. @Config(sdk = 27, application = TestApplication.class)
  12. public abstract class BaseTest {
  13. @Before
  14. public void beforeEach() {
  15. //
  16. }
  17. @After
  18. public void afterEach() {
  19. //
  20. }
  21. public Activity newActivity() {
  22. return Robolectric.setupActivity(AppCompatActivity.class);
  23. }
  24. public void assertIsChildById(ViewGroup parent, View child) {
  25. assertThat(parent).isNotNull();
  26. assertThat(child).isNotNull();
  27. assertThat(child.getId()).isNotZero().isPositive();
  28. assertThat(parent.findViewById(child.getId())).isNotNull().isEqualTo(child);
  29. }
  30. public void assertNotChildOf(ViewGroup parent, View child) {
  31. assertThat(parent).isNotNull();
  32. assertThat(child).isNotNull();
  33. assertThat(child.getId()).isNotZero().isPositive();
  34. assertThat(parent.findViewById(child.getId())).isNull();
  35. }
  36. }