### Question:
TouchInputHandler extends MotionInputHandler<K> { @Override public void onLongPress(@NonNull MotionEvent e) { if (!mDetailsLookup.overItemWithSelectionKey(e)) { if (DEBUG) Log.d(TAG, "Ignoring LongPress on non-model-backed item."); return; } ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null) { return; } boolean handled = false; if (isRangeExtension(e)) { extendSelectionRange(item); handled = true; } else { if (!mSelectionTracker.isSelected(item.getSelectionKey()) && mSelectionPredicate.canSetStateForKey(item.getSelectionKey(), true)) { if (selectItem(item)) { if (mSelectionPredicate.canSelectMultiple()) { mGestureStarter.run(); } handled = true; } } else { mOnDragInitiatedListener.onDragInitiated(e); handled = true; } } if (handled) { mHapticPerformer.run(); } } TouchInputHandler(
            @NonNull SelectionTracker<K> selectionTracker,
            @NonNull ItemKeyProvider<K> keyProvider,
            @NonNull ItemDetailsLookup<K> detailsLookup,
            @NonNull SelectionPredicate<K> selectionPredicate,
            @NonNull Runnable gestureStarter,
            @NonNull OnDragInitiatedListener onDragInitiatedListener,
            @NonNull OnItemActivatedListener<K> onItemActivatedListener,
            @NonNull FocusDelegate<K> focusDelegate,
            @NonNull Runnable hapticPerformer); @Override boolean onSingleTapUp(@NonNull MotionEvent e); @Override void onLongPress(@NonNull MotionEvent e);  }### Answer:
@Test public void testLongPress_SelectsItem() { mSelectionPredicate.setReturnValue(true); mDetailsLookup.initAt(7); mInputDelegate.onLongPress(TAP); mSelection.assertSelection(7); }
@Test public void testLongPress_StartsGestureSelection() { mSelectionPredicate.setReturnValue(true); mDetailsLookup.initAt(7); mInputDelegate.onLongPress(TAP); mGestureStarted.assertRan(); }
@Test public void testStartsSelection_PerformsHapticFeedback() { mSelectionPredicate.setReturnValue(true); mDetailsLookup.initAt(7); mInputDelegate.onLongPress(TAP); mHapticPerformer.assertRan(); }
@Test public void testLongPress_AddsToSelection() { mSelectionPredicate.setReturnValue(true); mDetailsLookup.initAt(7); mInputDelegate.onLongPress(TAP); mDetailsLookup.initAt(99); mInputDelegate.onLongPress(TAP); mDetailsLookup.initAt(13); mInputDelegate.onLongPress(TAP); mSelection.assertSelection(7, 13, 99); }