AutocompleteDetailFetchListener implements OnPlaceDetailsFetchedListener { @Override public void onFetchSuccess(Place place, String details) { Status status = new Status(Status.SUCCESS); setResultAndFinish(place, details, status); } AutocompleteDetailFetchListener(PlaceAutocompleteController controller); @Override void onFetchSuccess(Place place, String details); @Override void onFetchFailure();  }
@Test public void onFetchSuccess_shouldSetResult() throws Exception { Place place = mock(Place.class); String details = "details"; listener.onFetchSuccess(place, details); verify(controller).setResult(eq(place), eq(details), any(Status.class)); }
@Test public void onFetchSuccess_shouldHaveSuccessStatus() throws Exception { Place place = mock(Place.class); String details = "details"; ArgumentCaptor<Status> status = ArgumentCaptor.forClass(Status.class); listener.onFetchSuccess(place, details); verify(controller).setResult(eq(place), eq(details), status.capture()); assertEquals(Status.SUCCESS, status.getValue().getStatusCode()); }
@Test public void onFetchSuccess_shouldFinish() throws Exception { Place place = mock(Place.class); listener.onFetchSuccess(place, "details"); verify(controller).finish(); }