### Question:
Range { void extendRange(int position, @RangeType int type) { checkArgument(position != NO_POSITION, "Position cannot be NO_POSITION."); if (mEnd == NO_POSITION || mEnd == mBegin) { mEnd = NO_POSITION; establishRange(position, type); } else { reviseRange(position, type); } } Range(int position, @NonNull Callbacks callbacks); @Override String toString();  }### Answer:
@Test public void testExpandRange() { mRange = new Range(0, mSpy); mRange.extendRange(5, TYPE_PRIMARY); mRange.extendRange(10, TYPE_PRIMARY); mOperations.pop().assertChanged(6, 10, true); }
@Test public void testContractRange() { mRange = new Range(0, mSpy); mRange.extendRange(10, TYPE_PRIMARY); mRange.extendRange(5, TYPE_PRIMARY); mOperations.pop().assertChanged(6, 10, false); }
@Test public void testFlipRange_InitiallyDescending() { mRange = new Range(10, mSpy); mRange.extendRange(20, TYPE_PRIMARY); mRange.extendRange(5, TYPE_PRIMARY); mOperations.pop().assertChanged(5, 9, true); mOperations.pop().assertChanged(11, 20, false); }
@Test public void testFlipRange_InitiallyAscending() { mRange = new Range(10, mSpy); mRange.extendRange(5, TYPE_PRIMARY); mRange.extendRange(20, TYPE_PRIMARY); mOperations.pop().assertChanged(11, 20, true); mOperations.pop().assertChanged(5, 9, false); }
@Test public void testCouriesRangeType() { mRange = new Range(0, mSpy); mRange.extendRange(5, TYPE_PRIMARY); mOperations.pop().assertType(TYPE_PRIMARY); mRange.extendRange(10, TYPE_PROVISIONAL); mOperations.pop().assertType(TYPE_PROVISIONAL); }