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
24 changes: 11 additions & 13 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
ext {

version = [
autoValue : '1.5',
autoValueGson : '0.7.0',
autoValue : '1.6.2',
autoValueGson : '0.8.0',
junit : '4.12',
supportLibVersion: '26.1.0',
gson : '2.8.2',
retrofit : '2.3.0',
okhttp3 : '3.9.1',
mockito : '2.7.13',
supportLibVersion: '27.1.1',
gson : '2.8.5',
retrofit : '2.4.0',
okhttp3 : '3.11.0',
mockito : '2.18.3',
hamcrestJunit : '2.0.0.0',
errorprone : '2.0.21',
errorprone : '2.3.1',
]

pluginVersion = [
checkstyle : '7.8.2',
pmd : '5.8.1',
jacoco : '0.7.9',
errorprone : '0.0.10',
coveralls : '2.8.1',
checkstyle : '8.11.0',
jacoco : '0.8.1',
errorprone : '0.0.14',
spotbugs : '1.3',
sonarqube : '2.5',
buildConfig: '1.1.8',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.junit.rules.ExpectedException;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -299,8 +300,8 @@ public void annotations_doesGetFormattedInUrlCorrectly() throws Exception {
.overview(DirectionsCriteria.OVERVIEW_FULL)
.accessToken(ACCESS_TOKEN)
.build();
assertTrue(directions.cloneCall().request().url().toString()
.contains("annotations=congestion,duration"));
assertEquals("congestion,duration",
directions.cloneCall().request().url().queryParameter("annotations"));
}

@Test
Expand All @@ -312,7 +313,8 @@ public void addBearing_doesGetFormattedInUrlCorrectly() throws Exception {
.addBearing(2d, 90d)
.accessToken(ACCESS_TOKEN)
.build();
assertTrue(directions.cloneCall().request().url().toString().contains("bearings=45,90;2,90"));
assertEquals("45,90;2,90",
directions.cloneCall().request().url().queryParameter("bearings"));
}

@Test
Expand All @@ -323,7 +325,8 @@ public void radiuses_doesGetFormattedInUrlCorrectly() throws Exception {
.radiuses(23, 30)
.accessToken(ACCESS_TOKEN)
.build();
assertTrue(directions.cloneCall().request().url().toString().contains("radiuses=23;30"));
assertEquals("23;30",
directions.cloneCall().request().url().queryParameter("radiuses"));
}

@Test
Expand Down Expand Up @@ -458,8 +461,8 @@ public void testRadiusWithUnlimitedDistance() throws IOException {
.radiuses(100, Double.POSITIVE_INFINITY, 100)
.build();

assertThat(client.cloneCall().request().url().toString(),
containsString("radiuses=100;unlimited;100"));
assertEquals("100;unlimited;100",
client.cloneCall().request().url().queryParameter("radiuses"));
}

@Test
Expand Down Expand Up @@ -576,8 +579,9 @@ public void sanityApproachesInstructions() throws Exception {
.accessToken(ACCESS_TOKEN)
.build();
assertNotNull(mapboxDirections);
assertTrue(mapboxDirections.cloneCall().request().url().toString()
.contains("approaches=unrestricted;;;curb"));

assertEquals("unrestricted;;;curb",
mapboxDirections.cloneCall().request().url().queryParameter("approaches"));
}

@Test
Expand Down Expand Up @@ -640,7 +644,9 @@ public void testRouteOptionsApproaches() throws Exception {
Response<DirectionsResponse> response = mapboxDirections.executeCall();
RouteOptions routeOptions = response.body().routes().get(0).routeOptions();

assertEquals("unrestricted;curb", routeOptions.approaches());

String approaches = routeOptions.approaches();
assertEquals("unrestricted;curb", approaches);
}

@Test
Expand All @@ -654,8 +660,8 @@ public void sanityWaypointNamesInstructions() throws Exception {
.accessToken(ACCESS_TOKEN)
.build();
assertNotNull(mapboxDirections);
assertTrue(mapboxDirections.cloneCall().request().url().toString()
.contains("waypoint_names=Home;Store;Work"));
assertEquals("Home;Store;Work",
mapboxDirections.cloneCall().request().url().queryParameter("waypoint_names"));
}

@Test
Expand All @@ -680,7 +686,7 @@ public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception
thrown.expectMessage(
startsWith("Waypoint names exceed 500 character limit"));

StringBuffer longWpName = new StringBuffer();
StringBuilder longWpName = new StringBuilder();
for (int i = 0; i < 124; i++) {
longWpName.append("Home");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public void country_localeCountryHandlesMultipleCountriesCorrectly() throws Exce
.country(Locale.CANADA)
.query(Point.fromLngLat(-77.03655, 38.89770))
.build();
assertTrue(mapboxGeocoding.cloneCall().request().url().toString().contains("country=US,CA"));
assertEquals("US,CA",
mapboxGeocoding.cloneCall().request().url().queryParameter("country"));
}

@Test
Expand All @@ -143,8 +144,8 @@ public void proximity_doesGetAddedToUrlCorrectly() throws Exception {
.query("1600 pennsylvania ave nw")
.proximity(Point.fromLngLat(-77.03655, 38.89770))
.build();
assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
.contains("proximity=-77.03655,38.8977"));
assertEquals("-77.03655,38.8977",
mapboxGeocoding.cloneCall().request().url().queryParameter("proximity"));
}

@Test
Expand All @@ -155,8 +156,8 @@ public void geocodingTypes_getsAddedToUrlCorrectly() throws Exception {
.geocodingTypes(GeocodingCriteria.TYPE_COUNTRY, GeocodingCriteria.TYPE_DISTRICT)
.query("1600 pennsylvania ave nw")
.build();
assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
.contains("types=country,district"));
assertEquals("country,district",
mapboxGeocoding.cloneCall().request().url().queryParameter("types"));
}

@Test
Expand All @@ -182,8 +183,8 @@ public void bbox_getsFormattedCorrectlyForUrl() throws Exception {
)
.query("1600 pennsylvania ave nw")
.build();
assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
.contains("bbox=-77.083056,38.908611,-76.997778,38.959167"));
assertEquals("-77.083056,38.908611,-76.997778,38.959167",
mapboxGeocoding.cloneCall().request().url().queryParameter("bbox"));
}

@Test
Expand All @@ -206,7 +207,8 @@ public void language_getsConvertedToUrlCorrectly() throws Exception {
.languages(Locale.ENGLISH, Locale.FRANCE)
.query("1600 pennsylvania ave nw")
.build();
assertTrue(mapboxGeocoding.cloneCall().request().url().toString().contains("language=en,fr"));
assertEquals("en,fr",
mapboxGeocoding.cloneCall().request().url().queryParameter("language"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -31,7 +32,7 @@ public void id_returnsCorrectString() throws Exception {
.baseUrl(mockUrl.toString())
.build();
GeocodingResponse response = mapboxGeocoding.executeCall().body();
assert response != null;
assertNotNull(response);
assertThat(response.features().get(0).context().get(0).id(), equalTo("neighborhood.291451"));
}

Expand All @@ -43,7 +44,7 @@ public void text_returnsCorrectString() throws Exception {
.baseUrl(mockUrl.toString())
.build();
GeocodingResponse response = mapboxGeocoding.executeCall().body();
assert response != null;
assertNotNull(response);
assertThat(response.features().get(0).context().get(0).text(), equalTo("Downtown"));
}

Expand All @@ -55,7 +56,7 @@ public void shortCode_returnsCorrectString() throws Exception {
.baseUrl(mockUrl.toString())
.build();
GeocodingResponse response = mapboxGeocoding.executeCall().body();
assert response != null;
assertNotNull(response);
assertThat(response.features().get(0).context().get(3).shortCode(), equalTo("US-DC"));
}

Expand All @@ -67,7 +68,7 @@ public void wikidata_returnsCorrectString() throws Exception {
.baseUrl(mockUrl.toString())
.build();
GeocodingResponse response = mapboxGeocoding.executeCall().body();
assert response != null;
assertNotNull(response);
assertThat(response.features().get(0).context().get(2).wikidata(), equalTo("Q148"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.junit.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

import com.google.gson.JsonObject;
import com.mapbox.api.geocoding.v5.GeocodingTestUtils;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void geometry_returnsPointGeometry() throws Exception {
.build();

GeocodingResponse response = mapboxGeocoding.executeCall().body();
assert response != null;
assertNotNull(response);
CarmenFeature feature = response.features().get(0);
assertThat(feature.geometry(), notNullValue());
assertTrue(feature.geometry() instanceof Point);
Expand Down Expand Up @@ -114,7 +115,7 @@ public void toJson_handlesConversionCorrectly() throws IOException {
.baseUrl(mockUrl.toString())
.build();
GeocodingResponse response = mapboxGeocoding.executeCall().body();
assert response != null;
assertNotNull(response);
CarmenFeature feature = response.features().get(0);
compareJson(json, feature.toJson());
}
Expand All @@ -130,8 +131,7 @@ public void ForwardGeocode_withValidChineseResponse() throws Exception {
Response<GeocodingResponse> response = mapboxGeocoding.executeCall();
assertEquals(200, response.code());
GeocodingResponse object = response.body();
assert object != null;

assertNotNull(object);
CarmenFeature feature = object.features().get(0);

assertEquals(1, object.query().size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;

import com.mapbox.api.geocoding.v5.GeocodingTestUtils;
Expand Down Expand Up @@ -83,7 +84,7 @@ public void forwardRequest_invalidQuery() throws Exception {
Response<GeocodingResponse> response = mapboxGeocoding.executeCall();
assertEquals(200, response.code());
GeocodingResponse object = response.body();
assert object != null;
assertNotNull(object);

assertEquals(4, object.query().size());
assertThat(object.query().get(0), equalTo("sandy"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void simplify_withHighestQuality() throws IOException{

private List<Point> createPointListFromResourceFile(String fileName) throws IOException {
String inputPoints = loadJsonFixture(fileName);
String[] coords = inputPoints.split(",");
String[] coords = inputPoints.split(",", -1);

final List<Point> pointList = new ArrayList<>();
for(int i= 0;i <= coords.length-2;i = i+2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ private List<MapMatchingMatching> generateRouteOptions(Response<MapMatchingRespo
}

private static List<Point> formatCoordinates(String coordinates) {
String[] coordPairs = coordinates.split(";");
String[] coordPairs = coordinates.split(";", -1);
List<Point> coordinatesFormatted = new ArrayList<>();
for (String coordPair : coordPairs) {
String[] coords = coordPair.split(",");
String[] coords = coordPair.split(",", -1);
coordinatesFormatted.add(
Point.fromLngLat(Double.valueOf(coords[0]), Double.valueOf(coords[1])));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ public void radiuses_doesShowInUrlCorrectly() throws Exception {
.accessToken(ACCESS_TOKEN)
.radiuses(1d, 2d, 3d)
.build();
assertTrue(mapMatching.cloneCall().request().url().toString()
.contains("radiuses=1.0;2.0;3.0"));
assertEquals("1.0;2.0;3.0",
mapMatching.cloneCall().request().url().queryParameter("radiuses"));
}

@Test
Expand Down Expand Up @@ -340,8 +340,8 @@ public void timestamps_doesShowInUrlCorrectly() throws Exception {
.accessToken(ACCESS_TOKEN)
.timestamps("1", "2", "3")
.build();
assertTrue(mapMatching.cloneCall().request().url().toString()
.contains("timestamps=1;2;3"));
assertEquals("1;2;3",
mapMatching.cloneCall().request().url().queryParameter("timestamps"));
}

@Test
Expand All @@ -356,8 +356,8 @@ public void annotations_doesShowInUrlCorrectly() throws Exception {
DirectionsCriteria.ANNOTATION_DISTANCE,
DirectionsCriteria.ANNOTATION_CONGESTION
).build();
assertTrue(mapMatching.cloneCall().request().url().toString()
.contains("annotations=distance,congestion"));
assertEquals("distance,congestion",
mapMatching.cloneCall().request().url().queryParameter("annotations"));
}

@Test
Expand Down Expand Up @@ -543,8 +543,8 @@ public void sanityApproachesInstructions() throws Exception {
.accessToken(ACCESS_TOKEN)
.build();
assertNotNull(mapMatching);
assertTrue(mapMatching.cloneCall().request().url().toString()
.contains("approaches=unrestricted;;;curb"));
assertEquals("unrestricted;;;curb",
mapMatching.cloneCall().request().url().queryParameter("approaches"));
}

@Test
Expand Down Expand Up @@ -635,8 +635,8 @@ public void sanityWaypointNamesInstructions() throws Exception {
.addWaypointNames("Home", "Store", "Work")
.build();
assertNotNull(mapMatching);
assertTrue(mapMatching.cloneCall().request().url().toString()
.contains("waypoint_names=Home;Store;Work"));
assertEquals("Home;Store;Work",
mapMatching.cloneCall().request().url().queryParameter("waypoint_names"));
}

@Test
Expand Down Expand Up @@ -664,7 +664,7 @@ public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception
thrown.expectMessage(
startsWith("Waypoint names exceed 500 character limit"));

StringBuffer longWpName = new StringBuffer();
StringBuilder longWpName = new StringBuilder();
for (int i = 0; i < 124; i++) {
longWpName.append("Home");
}
Expand Down
1 change: 1 addition & 0 deletions services-speech/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {

// AutoValue
compileOnly dependenciesList.autoValue
compileOnly dependenciesList.autoValueGson

// Test Dependencies
testImplementation dependenciesList.okhttp3Mockwebserver
Expand Down