@Test
public void readPlaceDetailsTest() throws IOException {

    when(parser.readPlaceDetails(reader)).thenCallRealMethod();
    Boolean[] hasNextValues = new Boolean[20];
    Arrays.fill(hasNextValues, 0, 19, Boolean.TRUE);
    hasNextValues[19] = Boolean.FALSE;
    when(reader.hasNext()).thenReturn(true, hasNextValues);
    String[] names = new String[] {
            "address_components",
            "formatted_address",
            "formatted_phone_number",
            "international_phone_number",
            "geometry",
            "icon",
            "name",
            "place_id",
            "opening_hours",
            "permanently_closed",
            "photos",
            "scope",
            "alt_ids",
            "price_level",
            "rating",
            "reviews",
            "types",
            "url",
            "vicinity"
    };
    when(reader.nextName()).thenReturn("skip", names);
    when(parser.readAddressComponentsArray(reader)).thenReturn(Collections.singletonList(new AddressComponent("long", "short", Collections.singletonList(AddressComponentType.ROOM))));
    when(reader.nextString()).thenReturn("addr", "phone", "intl_phone", "icon", "name", "id", "url", "vic");
    when(parser.readGeometry(reader)).thenReturn(new PlaceGeometry(new PlaceLocation(1.0, 2.0)));
    when(parser.readOpeningHours(reader)).thenReturn(new OpenHours(true, Collections.singletonList(new OpenPeriod(new DateTimePair("one", "two"), new DateTimePair("three", "four")))));
    when(reader.nextBoolean()).thenReturn(true);
    when(parser.readPhotosArray(reader)).thenReturn(Collections.singletonList(new PlacePhoto(1, 2, "ref")));
    when(parser.readScope(reader)).thenReturn(PlaceScope.GOOGLE);
    when(parser.readAltIdsArray(reader)).thenReturn(Collections.singletonList(new AlternativePlaceId("id", PlaceScope.GOOGLE)));
    when(reader.nextInt()).thenReturn(5);
    when(reader.nextDouble()).thenReturn(5.0);
    when(parser.readReviewsArray(reader)).thenReturn(Collections.singletonList(new PlaceReview(Collections.singletonList(new RatingAspect(5, "quality")), "name", "url", "en", 4, "txt", 10L)));
    when(parser.readTypesArray(reader)).thenReturn(Collections.singletonList("type"));
    PlaceDetails expected = new PlaceDetails(Collections.singletonList(new AddressComponent("long", "short", Collections.singletonList(AddressComponentType.ROOM))),
            "addr",
            "phone",
            "intl_phone",
            new PlaceGeometry(new PlaceLocation(1.0, 2.0)),
            "icon",
            "name",
            "id",
            new OpenHours(true, Collections.singletonList(new OpenPeriod(new DateTimePair("one", "two"), new DateTimePair("three", "four")))),
            true,
            Collections.singletonList(new PlacePhoto(1, 2, "ref")),
            PlaceScope.GOOGLE,
            Collections.singletonList(new AlternativePlaceId("id", PlaceScope.GOOGLE)),
            5,
            5.0,
            Collections.singletonList(new PlaceReview(Collections.singletonList(new RatingAspect(5, "quality")), "name", "url", "en", 4, "txt", 10L)),
            Collections.singletonList("type"),
            "url",
            "vic");
    PlaceDetails actual = parser.readPlaceDetails(reader);
    assertEquals(expected, actual);
}