@Test
  public void testGeocodeWithJustComponents() throws Exception {
    try (LocalTestServerContext sc =
        new LocalTestServerContext(
            "\n"
                + "{\n"
                + "   \"results\" : [\n"
                + "      {\n"
                + "         \"address_components\" : [\n"
                + "            {\n"
                + "               \"long_name\" : \"Annankatu\",\n"
                + "               \"short_name\" : \"Annankatu\",\n"
                + "               \"types\" : [ \"route\" ]\n"
                + "            },\n"
                + "            {\n"
                + "               \"long_name\" : \"Helsinki\",\n"
                + "               \"short_name\" : \"HKI\",\n"
                + "               \"types\" : [ \"locality\", \"political\" ]\n"
                + "            },\n"
                + "            {\n"
                + "               \"long_name\" : \"Finland\",\n"
                + "               \"short_name\" : \"FI\",\n"
                + "               \"types\" : [ \"country\", \"political\" ]\n"
                + "            },\n"
                + "            {\n"
                + "               \"long_name\" : \"00101\",\n"
                + "               \"short_name\" : \"00101\",\n"
                + "               \"types\" : [ \"postal_code\" ]\n"
                + "            }\n"
                + "         ],\n"
                + "         \"formatted_address\" : \"Annankatu, 00101 Helsinki, Finland\",\n"
                + "         \"geometry\" : {\n"
                + "            \"bounds\" : {\n"
                + "               \"northeast\" : {\n"
                + "                  \"lat\" : 60.168997,\n"
                + "                  \"lng\" : 24.9433353\n"
                + "               },\n"
                + "               \"southwest\" : {\n"
                + "                  \"lat\" : 60.16226160000001,\n"
                + "                  \"lng\" : 24.9332897\n"
                + "               }\n"
                + "            },\n"
                + "            \"location\" : {\n"
                + "               \"lat\" : 60.1657808,\n"
                + "               \"lng\" : 24.938451\n"
                + "            },\n"
                + "            \"location_type\" : \"GEOMETRIC_CENTER\",\n"
                + "            \"viewport\" : {\n"
                + "               \"northeast\" : {\n"
                + "                  \"lat\" : 60.168997,\n"
                + "                  \"lng\" : 24.9433353\n"
                + "               },\n"
                + "               \"southwest\" : {\n"
                + "                  \"lat\" : 60.16226160000001,\n"
                + "                  \"lng\" : 24.9332897\n"
                + "               }\n"
                + "            }\n"
                + "         },\n"
                + "         \"place_id\" : \"EiBBbm5hbmthdHUsIDAwMTAxIEhlbHNpbmtpLCBTdW9taQ\",\n"
                + "         \"types\" : [ \"route\" ]\n"
                + "      }\n"
                + "   ],\n"
                + "   \"status\" : \"OK\"\n"
                + "}\n")) {
      GeocodingResult[] results =
          GeocodingApi.newRequest(sc.context)
              .components(
                  ComponentFilter.route("Annegatan"),
                  ComponentFilter.administrativeArea("Helsinki"),
                  ComponentFilter.country("Finland"))
              .await()
              .results;

      assertNotNull(results);
      assertNotNull(Arrays.toString(results));
      assertEquals("Annankatu, 00101 Helsinki, Finland", results[0].formattedAddress);
      assertEquals("EiBBbm5hbmthdHUsIDAwMTAxIEhlbHNpbmtpLCBTdW9taQ", results[0].placeId);

      sc.assertParamValue(
          "route:Annegatan|administrative_area:Helsinki|country:Finland", "components");
    }
  }
Making a request using just components filter: <a
href="https://maps.googleapis.com/maps/api/geocode/json?components=route:Annegatan|administrative_area:Helsinki|country:Finland">
Searching for a route of Annegatan, in the administrative area of Helsinki, and the country of
Finland </a>.
src/test/java/com/google/maps/GeocodingApiTest.java