예제 #1
0
 @Test
 public void testPhoto() throws IOException {
   PlacesParams params = Params.create();
   Response<List<Place>> search = Places.textSearch(params.query("pizza near times square"));
   testSearch(search);
   boolean tested = false;
   for (Place place : search.getResult()) {
     List<Photo> photos = place.getPhotos();
     if (!photos.isEmpty()) {
       Photo photo = photos.get(0);
       assertTrue(!photo.getReference().isEmpty());
       params.clear();
       Response<InputStream> resp =
           Places.photo(params.reference(photo.getReference()).maxWidth(100).maxHeight(75));
       assertEquals(STATUS_OK, resp.getStatus());
       InputStream in = resp.getResult();
       assertNotNull(in);
       byte[] b = new byte[8192];
       while (in.read(b) != -1) {}
       in.close();
       tested = true;
       break;
     }
   }
   assertTrue(tested);
 }
예제 #2
0
 @Test
 public void testDetails() throws IOException {
   PlacesParams params = Params.create();
   Response<List<Place>> search = Places.textSearch(params.query("pizza near times square"));
   testSearch(search);
   Place place = search.getResult().get(0);
   params.clear();
   Response<Place> details = Places.details(params.placeId(place.getPlaceId().getId()));
   assertEquals(STATUS_OK, details.getStatus());
   place = details.getResult();
   assertNotNull(place);
   assertTrue(!place.getPlaceId().getId().isEmpty());
 }