@Test
  public void testTransitWithoutSpecifyingTime() throws Exception {
    try (LocalTestServerContext sc =
        new LocalTestServerContext("{\"routes\": [{}],\"status\": \"OK\"}")) {
      DirectionsResult result =
          DirectionsApi.newRequest(sc.context)
              .origin("Fisherman's Wharf, San Francisco")
              .destination("Union Square, San Francisco")
              .mode(TravelMode.TRANSIT)
              .await();

      sc.assertParamValue("Fisherman's Wharf, San Francisco", "origin");
      sc.assertParamValue("Union Square, San Francisco", "destination");
      sc.assertParamValue(TravelMode.TRANSIT.toUrlValue(), "mode");

      assertNotNull(result.toString());
    }
  }
Test transit without arrival or departure times specified.
src/test/java/com/google/maps/DirectionsApiTest.java