### Question:
FetchCodeReviewsTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), 2); this.reviews = server.downloadReviews(course); progress.incrementProgress(1); if (this.reviews == null) { return RETURN_FAILURE; } if (shouldStop(progress)) { return BackgroundTask.RETURN_INTERRUPTED; } this.reviewDAO.addAll(reviews); progress.incrementProgress(1); return RETURN_SUCCESS; } FetchCodeReviewsTask(Course course, ServerManager server, ReviewDAO reviewDAO); @Override int start(TaskStatusMonitor progress);  }### Answer:
@Test public void feedbackIsInitializedCorrectly() { task.start(progress); verify(progress, times(1)).startProgress("Checking for new code reviews", 2); }
@Test public void fetchGetsReviewsFromServerAndIncrementsProgressByOne() { task.start(progress); verify(server, times(1)).downloadReviews(course); verify(progress, atLeast(1)).incrementProgress(1); }
@Test public void taskReportsFailureIfFetchedReviewsListIsNull() { when(server.downloadReviews(course)).thenReturn(null); assertEquals(BackgroundTask.RETURN_FAILURE, task.start(progress)); }
@Test public void taskAddReviewsToReviewDAOAfterSuccefullFetchAndReturnSuccess() { List<Review> reviews = new ArrayList<Review>(); when(server.downloadReviews(course)).thenReturn(reviews); assertEquals(BackgroundTask.RETURN_SUCCESS, task.start(progress)); verify(reviewDAO, times(1)).addAll(reviews); verify(progress, times(2)).incrementProgress(1); }