Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions src/test/java/com/google/maps/DirectionsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,30 +281,6 @@ public void testTrafficModel() throws Exception {
assertNotNull(result.routes[0].legs[0].durationInTraffic);
}

/**
* Test fares are returned for transit requests that support them.
*/
@Test
public void testFares() throws Exception {
DirectionsResult result = DirectionsApi.newRequest(context)
.origin("Parada República 2, Brazil")
.destination("Praça Pres. Kenedy, Santo André - SP, Brazil")
.mode(TravelMode.TRANSIT)
.departureTime(new DateTime(2015, 1, 1, 19, 0, DateTimeZone.UTC))
.await();

// Just in case we get a walking route or something silly
for (DirectionsRoute route : result.routes) {
if (route.fare != null) {
assertNotNull(route.fare.value);
assertNotNull(route.fare.currency);
assertEquals("BRL", route.fare.currency.getCurrencyCode());
return;
}
}
fail("Fare data not found in any route");
}

/**
* Test transit without arrival or departure times specified.
*/
Expand Down Expand Up @@ -341,39 +317,6 @@ public void testNotFound() throws Exception {
DirectionsApi.getDirections(context, "fksjdhgf", "faldfdaf").await();
}

/**
* Test transit details.
*/
@Test
public void testTransitDetails() throws Exception {
DirectionsResult result = DirectionsApi.newRequest(context)
.origin("Bibliotheque Francois Mitterrand, Paris")
.destination("Pyramides, Paris")
.mode(TravelMode.TRANSIT)
.departureTime(new DateTime(2015, 2, 15, 11, 0, DateTimeZone.UTC))
.await();

DirectionsLeg testLeg = result.routes[0].legs[0];

// Skip the initial walking steps
int i = 0;
while (testLeg.steps[i].travelMode != TravelMode.TRANSIT) {
i++;
}

assertTrue("Could not find a transit leg in directions",
i < testLeg.steps.length);

assertNotNull(testLeg.steps[i].transitDetails);
assertNotNull(testLeg.steps[i].transitDetails.arrivalStop);
assertNotNull(testLeg.steps[i].transitDetails.arrivalTime);
assertNotNull(testLeg.steps[i].transitDetails.departureStop);
assertNotNull(testLeg.steps[i].transitDetails.departureTime);
assertNotNull(testLeg.steps[i].transitDetails.line);
assertNotNull(testLeg.steps[i].transitDetails.line.agencies);
assertNotNull(testLeg.steps[i].transitDetails.line.vehicle);
}

/**
* Test GeocodedWaypoints results.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,31 +117,6 @@ public void testLanguageParameter() throws Exception {
assertNotNull(matrix);
}

@Test
public void testTransitData() throws Exception {
DistanceMatrix matrix = DistanceMatrixApi.newRequest(context)
.origins("Parada República 2, Brazil")
.destinations("Praça Pres. Kenedy, Santo André - SP, Brazil")
.mode(TravelMode.TRANSIT)
.departureTime(new DateTime(2015, 1, 1, 19, 0, DateTimeZone.UTC))
.await();

assertNotNull(matrix);

for (DistanceMatrixRow row : matrix.rows) {
for (DistanceMatrixElement cell : row.elements) {
if (cell.fare != null) {
assertNotNull(cell.fare.value);
assertNotNull(cell.fare.currency);
assertEquals("BRL", cell.fare.currency.getCurrencyCode());
return;
}
}
}

fail("No fare information found in a transit search.");
}

/**
* Test transit without arrival or departure times specified.
*/
Expand All @@ -157,37 +132,10 @@ public void testTransitWithoutSpecifyingTime() throws Exception {
// routes, but the main thing to catch is that no exception is thrown.
}

@Test
public void testTransitWithArrivalTime() throws Exception {
DistanceMatrix matrix = DistanceMatrixApi.newRequest(context)
.origins("Fisherman's Wharf, San Francisco", "Union Square, San Francisco")
.destinations("Mikkeller Bar, San Francisco", "Moscone Center, San Francisco")
.mode(TravelMode.TRANSIT)
.arrivalTime(new DateTime(2015, 1, 1, 19, 0, DateTimeZone.UTC))
.await();

assertNotNull(matrix);
assertEquals(DistanceMatrixElementStatus.OK, matrix.rows[0].elements[0].status);
}

/**
* Test the extended transit parameters: mode and routing preference.
* Test duration in traffic with traffic model set.
*/
@Test
public void testTransitParams() throws Exception {
DistanceMatrix matrix = DistanceMatrixApi.newRequest(context)
.origins("Fisherman's Wharf, San Francisco", "Union Square, San Francisco")
.destinations("Mikkeller Bar, San Francisco", "Moscone Center, San Francisco")
.mode(TravelMode.TRANSIT)
.transitModes(TransitMode.RAIL, TransitMode.TRAM)
.transitRoutingPreference(TransitRoutingPreference.LESS_WALKING)
.arrivalTime(new DateTime(2015, 1, 1, 19, 0, DateTimeZone.UTC))
.await();

assertNotNull(matrix);
assertEquals(DistanceMatrixElementStatus.OK, matrix.rows[0].elements[0].status);
}

@Test
public void testDurationInTrafficWithTrafficModel() throws Exception {
final long ONE_HOUR_MILLIS = 60 * 60 * 1000;
Expand Down
14 changes: 0 additions & 14 deletions src/test/java/com/google/maps/PlacesApiIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,6 @@ public void testPlaceDetailsInFrench() throws Exception {
assertEquals("Sacré-Cœur", details.name);
}

@Test
public void testPlaceTextSearchPermanentlyClosed() throws Exception {
PlacesSearchResponse response = PlacesApi.textSearchQuery(context, "ABC Learning Centres in australia").await();
assertNotNull(response);
for (PlacesSearchResult result : response.results) {
assertNotNull(result);
if (result.permanentlyClosed) {
// test success condition
return;
}
}
fail("No permanently closed result found.");
}

@Test
public void testNearbySearchRequestByKeyword() throws Exception {
PlacesSearchResponse response = PlacesApi.nearbySearchQuery(context, SYDNEY)
Expand Down