react-native-navigation的迁移库

TestUtils.java 775B

12345678910111213141516171819202122232425262728
  1. package com.reactnativenavigation.layout;
  2. import android.view.View;
  3. import android.view.ViewGroup;
  4. import java.util.ArrayList;
  5. import java.util.Arrays;
  6. import java.util.List;
  7. import static org.assertj.core.api.Java6Assertions.assertThat;
  8. public class TestUtils {
  9. public static List<View> assertViewChildrenCount(ViewGroup view, int count) {
  10. assertThat(view.getChildCount()).isEqualTo(count);
  11. final List<View> children = new ArrayList<>(count);
  12. for (int i = 0; i < count; i++) {
  13. children.add(view.getChildAt(i));
  14. }
  15. return children;
  16. }
  17. public static void assertViewChildren(ViewGroup view, View... children) {
  18. final List<View> childViews = assertViewChildrenCount(view, children.length);
  19. assertThat(childViews).isEqualTo(Arrays.asList(children));
  20. }
  21. }