@Test
public void readAddressComponentTypesArrayTest() throws IOException {

    when(parser.readAddressComponentTypesArray(reader)).thenCallRealMethod();
    // hasNext() should return true N times, where N is the number of AddressComponentTypes
    int numOfTypes = AddressComponentType.values().length;
    Boolean[] hasNextValues = new Boolean[numOfTypes + 1];
    Arrays.fill(hasNextValues, 0, numOfTypes, Boolean.TRUE);
    hasNextValues[numOfTypes] = Boolean.FALSE; // indicate stop
    when(reader.hasNext()).thenReturn(true, hasNextValues); // initial true is for "skip"
    String[] types = new String[] {
            "administrative_area_level_1",
            "administrative_area_level_2",
            "administrative_area_level_3",
            "administrative_area_level_4",
            "administrative_area_level_5",
            "colloquial_area",
            "country",
            "floor",
            "geocode",
            "intersection",
            "locality",
            "natural_feature",
            "neighborhood",
            "political",
            "point_of_interest",
            "post_box",
            "postal_code",
            "postal_code_prefix",
            "postal_code_suffix",
            "postal_town",
            "premise",
            "room",
            "route",
            "street_address",
            "street_number",
            "sublocality",
            "sublocality_level_1",
            "sublocality_level_2",
            "sublocality_level_3",
            "sublocality_level_4",
            "sublocality_level_5",
            "subpremise",
            "transit_station"
    };
    when(reader.nextString()).thenReturn("skip", types);
    List<AddressComponentType> expected = new ArrayList<>();
    for (String type : types) {
        expected.add(AddressComponentType.valueOf(type.toUpperCase()));
    }
    List<AddressComponentType> actual = parser.readAddressComponentTypesArray(reader);
    assertEquals(expected, actual);
}