### Question:
MouseInputHandler extends MotionInputHandler<K> { @Override public boolean onSingleTapConfirmed(@NonNull MotionEvent e) { if (mHandledTapUp) { if (VERBOSE) { Log.v(TAG, "Ignoring onSingleTapConfirmed, previously handled in onSingleTapUp."); } mHandledTapUp = false; return false; } if (mSelectionTracker.hasSelection()) { return false; } if (!mDetailsLookup.overItem(e)) { if (DEBUG) Log.d(TAG, "Ignoring Confirmed Tap on non-item."); return false; } if (MotionEvents.isTertiaryMouseButtonPressed(e)) { if (DEBUG) Log.d(TAG, "Ignoring middle click"); return false; } @Nullable ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null || !item.hasSelectionKey()) { return false; } if (mFocusDelegate.hasFocusedItem() && MotionEvents.isShiftKeyPressed(e)) { mSelectionTracker.startRange(mFocusDelegate.getFocusedPosition()); mSelectionTracker.extendRange(item.getPosition()); } else { selectOrFocusItem(item, e); } return true; } MouseInputHandler(
            @NonNull SelectionTracker<K> selectionTracker,
            @NonNull ItemKeyProvider<K> keyProvider,
            @NonNull ItemDetailsLookup<K> detailsLookup,
            @NonNull OnContextClickListener onContextClickListener,
            @NonNull OnItemActivatedListener<K> onItemActivatedListener,
            @NonNull FocusDelegate<K> focusDelegate); @Override boolean onDown(@NonNull MotionEvent e); @Override boolean onScroll(@NonNull MotionEvent e1, @NonNull MotionEvent e2,
            float distanceX, float distanceY); @Override boolean onSingleTapUp(@NonNull MotionEvent e); @Override boolean onSingleTapConfirmed(@NonNull MotionEvent e); @Override boolean onDoubleTap(@NonNull MotionEvent e);  }### Answer:
@Test public void testConfirmedClick_StartsSelection() { mDetailsLookup.initAt(11).setInItemSelectRegion(true); mInputDelegate.onSingleTapConfirmed(CLICK); mSelection.assertSelection(11); }
@Test public void testConfirmedShiftClick_ExtendsSelectionFromFocus() { TestItemDetails item = mDetailsLookup.initAt(7); mFocusCallbacks.focusItem(item); mDetailsLookup.initAt(11); mInputDelegate.onSingleTapConfirmed(SHIFT_CLICK); mSelection.assertSelection(7, 8, 9, 10, 11); }
@Test public void testMiddleClick_DoesNothing() { mDetailsLookup.initAt(11).setInItemSelectRegion(true); mInputDelegate.onSingleTapConfirmed(TERTIARY_CLICK); mSelection.assertNoSelection(); }
@Test public void testClick_Focuses() { mDetailsLookup.initAt(11).setInItemSelectRegion(false); mInputDelegate.onSingleTapConfirmed(CLICK); mFocusCallbacks.assertHasFocus(true); mFocusCallbacks.assertFocused("11"); }