ScrollAction extends SimpleAction { @Override public boolean perform(UiObject root) { List<UiObject> scrollableNodes = findScrollableNodes(root); boolean result = mIndex < scrollableNodes.size() && scrollableNodes.get(mIndex).performAction(mAction); recycle(scrollableNodes, root); return result; } ScrollAction(int action, int i); @Override boolean perform(UiObject root);  }
@Test public void perform() throws Exception { ScrollAction action = new ScrollAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD, 0); UiObject root = new TestUiObject(5); action.perform(root); System.out.println(TestUiObject.max); assertEquals(1, TestUiObject.count); }