@Test
  public void testGeocodeWithMultipleComponentFilters() throws Exception {
    try (LocalTestServerContext sc =
        new LocalTestServerContext(
            "\n"
                + "{\n"
                + "   \"results\" : [\n"
                + "      {\n"
                + "         \"address_components\" : [\n"
                + "            {\n"
                + "               \"long_name\" : \"Texas\",\n"
                + "               \"short_name\" : \"TX\",\n"
                + "               \"types\" : [\n"
                + "                  \"administrative_area_level_1\",\n"
                + "                  \"establishment\",\n"
                + "                  \"point_of_interest\",\n"
                + "                  \"political\"\n"
                + "               ]\n"
                + "            },\n"
                + "            {\n"
                + "               \"long_name\" : \"United States\",\n"
                + "               \"short_name\" : \"US\",\n"
                + "               \"types\" : [ \"country\", \"political\" ]\n"
                + "            }\n"
                + "         ],\n"
                + "         \"formatted_address\" : \"Texas, USA\",\n"
                + "         \"geometry\" : {\n"
                + "            \"bounds\" : {\n"
                + "               \"northeast\" : {\n"
                + "                  \"lat\" : 36.5007041,\n"
                + "                  \"lng\" : -93.5080389\n"
                + "               },\n"
                + "               \"southwest\" : {\n"
                + "                  \"lat\" : 25.8371638,\n"
                + "                  \"lng\" : -106.6456461\n"
                + "               }\n"
                + "            },\n"
                + "            \"location\" : {\n"
                + "               \"lat\" : 31.9685988,\n"
                + "               \"lng\" : -99.9018131\n"
                + "            },\n"
                + "            \"location_type\" : \"APPROXIMATE\",\n"
                + "            \"viewport\" : {\n"
                + "               \"northeast\" : {\n"
                + "                  \"lat\" : 36.5018864,\n"
                + "                  \"lng\" : -93.5080389\n"
                + "               },\n"
                + "               \"southwest\" : {\n"
                + "                  \"lat\" : 25.83819,\n"
                + "                  \"lng\" : -106.6452951\n"
                + "               }\n"
                + "            }\n"
                + "         },\n"
                + "         \"partial_match\" : true,\n"
                + "         \"place_id\" : \"ChIJSTKCCzZwQIYRPN4IGI8c6xY\",\n"
                + "         \"types\" : [\n"
                + "            \"administrative_area_level_1\",\n"
                + "            \"establishment\",\n"
                + "            \"point_of_interest\",\n"
                + "            \"political\"\n"
                + "         ]\n"
                + "      }\n"
                + "   ],\n"
                + "   \"status\" : \"OK\"\n"
                + "}\n")) {
      GeocodingResult[] results =
          GeocodingApi.newRequest(sc.context)
              .address("Torun")
              .components(administrativeArea("TX"), country("US"))
              .await()
              .results;

      assertNotNull(Arrays.toString(results));

      assertEquals("Texas, USA", results[0].formattedAddress);
      assertEquals(true, results[0].partialMatch);
      assertEquals("ChIJSTKCCzZwQIYRPN4IGI8c6xY", results[0].placeId);

      sc.assertParamValue("administrative_area:TX|country:US", "components");
      sc.assertParamValue("Torun", "address");
    }
  }
Geocode with multiple component filters: <a
href="https://maps.googleapis.com/maps/api/geocode/json?address=Torun&components=administrative_area:TX|country:US">
Geocoding Torun, with administrative area of "TX" and country of "US"</a>.
src/test/java/com/google/maps/GeocodingApiTest.java