### Question:
TouchInputHandler extends MotionInputHandler<K> { @Override public boolean onSingleTapUp(@NonNull MotionEvent e) { if (!mDetailsLookup.overItemWithSelectionKey(e)) { if (DEBUG) Log.d(TAG, "Tap not associated w/ model item. Clearing selection."); mSelectionTracker.clearSelection(); return false; } ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null) { return false; } if (mSelectionTracker.hasSelection()) { if (isRangeExtension(e)) { extendSelectionRange(item); } else if (mSelectionTracker.isSelected(item.getSelectionKey())) { mSelectionTracker.deselect(item.getSelectionKey()); } else { selectItem(item); } return true; } return item.inSelectionHotspot(e) ? selectItem(item) : mOnItemActivatedListener.onItemActivated(item, e); } 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 testTap_ActivatesWhenNoExistingSelection() { ItemDetails doc = mDetailsLookup.initAt(11); mInputDelegate.onSingleTapUp(TAP); mActivationCallbacks.assertActivated(doc); }
@Test public void testSelectHotspot_StartsSelectionMode() { mSelectionPredicate.setReturnValue(true); mDetailsLookup.initAt(7).setInItemSelectRegion(true); mInputDelegate.onSingleTapUp(TAP); mSelection.assertSelection(7); }
@Test public void testSelectionHotspot_UnselectsSelectedItem() { mSelectionMgr.select("11"); mDetailsLookup.initAt(11).setInItemSelectRegion(true); mInputDelegate.onSingleTapUp(TAP); mSelection.assertNoSelection(); }
@Test public void testTap_UnselectsSelectedItem() { mSelectionMgr.select("11"); mDetailsLookup.initAt(11); mInputDelegate.onSingleTapUp(TAP); mSelection.assertNoSelection(); }