AutocompleteDetailFetchListener implements OnPlaceDetailsFetchedListener { @Override public void onFetchFailure() { Status status = new Status(Status.INTERNAL_ERROR); setResultAndFinish(null, null, status); } AutocompleteDetailFetchListener(PlaceAutocompleteController controller); @Override void onFetchSuccess(Place place, String details); @Override void onFetchFailure();  }
@Test public void onFetchFailure_shouldSetResult() throws Exception { listener.onFetchFailure(); verify(controller).setResult(isNull(Place.class), isNull(String.class), any(Status.class)); }
@Test public void onFetchFailure_shouldHaveInternalErrorStatus() throws Exception { ArgumentCaptor<Status> status = ArgumentCaptor.forClass(Status.class); listener.onFetchFailure(); verify(controller).setResult(isNull(Place.class), isNull(String.class), status.capture()); assertEquals(Status.INTERNAL_ERROR, status.getValue().getStatusCode()); }
@Test public void onFetchFailure_shouldFinish() throws Exception { listener.onFetchFailure(); verify(controller).finish(); }