AndroidPlacesApiJsonParser implements PlacesApiJsonParser { PlaceScope readScope(JsonReader reader) throws IOException { switch (reader.nextString()) { case "APP": return PlaceScope.APP; case "GOOGLE": return PlaceScope.GOOGLE; default: return null; } }  @Override PlacesAutocompleteResponse autocompleteFromStream(final InputStream is); @Override PlacesDetailsResponse detailsFromStream(final InputStream is); @Override List<Place> readHistoryJson(final InputStream in); @Override void writeHistoryJson(final OutputStream os, final List<Place> places);  }
@Test public void readScopeTest() throws IOException { when(parser.readScope(reader)).thenCallRealMethod(); when(reader.nextString()).thenReturn("APP", "GOOGLE", "skip"); assertEquals(PlaceScope.APP, parser.readScope(reader)); assertEquals(PlaceScope.GOOGLE, parser.readScope(reader)); assertNull(parser.readScope(reader)); }