### Question:
RotateGestureDetector extends ProgressiveGesture<RotateGestureDetector.OnRotateGestureListener> { @Override protected boolean analyzeMovement() { super.analyzeMovement(); deltaSinceLast = getRotationDegreesSinceLast(); deltaSinceStart += deltaSinceLast; if (isInProgress() && deltaSinceLast != 0) { return listener.onRotate(this, deltaSinceLast, deltaSinceStart); } else if (canExecute(GESTURE_TYPE_ROTATE)) { if (listener.onRotateBegin(this)) { gestureStarted(); return true; } } return false; } RotateGestureDetector(Context context, AndroidGesturesManager gesturesManager); float getDeltaSinceStart(); float getDeltaSinceLast(); float getAngleThreshold(); void setAngleThreshold(float angleThreshold);  }### Answer:
@Test public void analyzeMovementTest() throws Exception { when(listener.onRotateBegin(gestureDetector)).thenReturn(true); when(listener.onRotate(gestureDetector, gestureDetector.deltaSinceLast, gestureDetector.deltaSinceStart)) .thenReturn(true); doReturn(Constants.DEFAULT_ROTATE_ANGLE_THRESHOLD / 2) .when(gestureDetector).getRotationDegreesSinceLast(); gestureDetector.analyzeMovement(); doReturn(Constants.DEFAULT_ROTATE_ANGLE_THRESHOLD * 2) .when(gestureDetector).getRotationDegreesSinceLast(); gestureDetector.analyzeMovement(); gestureDetector.analyzeMovement(); verify(listener, times(1)).onRotate(gestureDetector, gestureDetector.deltaSinceLast, gestureDetector.deltaSinceStart); doReturn(Constants.DEFAULT_ROTATE_ANGLE_THRESHOLD / 2) .when(gestureDetector).getRotationDegreesSinceLast(); gestureDetector.analyzeMovement(); verify(listener, times(1)).onRotate(gestureDetector, gestureDetector.deltaSinceLast, gestureDetector.deltaSinceStart); gestureDetector.gestureStopped(); gestureDetector.analyzeMovement(); verify(listener, times(1)).onRotateBegin(gestureDetector); verify(listener, times(1)).onRotateEnd( gestureDetector, gestureDetector.velocityX, gestureDetector.velocityY, gestureDetector.calculateAngularVelocityVector(gestureDetector.velocityX, gestureDetector.velocityY)); }