コード例 #1
0
 public void testGetPlaceLocationsList() {
   T21ServicesApi t21ServicesApi = apiProvider.getT21ServicesApi();
   PlaceLocationsList placeLocationsList = t21ServicesApi.getPlacesList();
   PlaceLocation firstPlaceLocation = placeLocationsList.getList().get(0);
   assertEquals("ERROR: Error to read id", firstPlaceLocation.getId(), 1);
   assertEquals("ERROR: Error to read title", firstPlaceLocation.getTitle(), "Casa Batlló");
 }
コード例 #2
0
  public void testLoadPlaceDetailsIntoDatabase() {
    T21ServicesApi t21ServicesApi = apiProvider.getT21ServicesApi();
    PlaceLocationsList placeLocationsList = t21ServicesApi.getPlacesList();

    for (PlaceLocation placeLocation : placeLocationsList.getList()) {
      int placeId = placeLocation.getId();
      PlaceDetails placeDetails = t21ServicesApi.getPlaceDetails(placeId);
      ContentValues contentValues = placeDetails.toContentValues();
      getContext().getContentResolver().insert(PlaceDetailsEntry.CONTENT_URI, contentValues);
    }
  }