Skip to content

Commit e25b6c9

Browse files
authored
upgragedd dependecies (#853)
As per OKHTTP changes, HttpUrl Parameters percent-escape more characters. Previously several ASCII punctuation characters were not percent-escaped.
1 parent b684469 commit e25b6c9

10 files changed

Lines changed: 65 additions & 56 deletions

File tree

gradle/dependencies.gradle

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
ext {
22

33
version = [
4-
autoValue : '1.5',
5-
autoValueGson : '0.7.0',
4+
autoValue : '1.6.2',
5+
autoValueGson : '0.8.0',
66
junit : '4.12',
7-
supportLibVersion: '26.1.0',
8-
gson : '2.8.2',
9-
retrofit : '2.3.0',
10-
okhttp3 : '3.9.1',
11-
mockito : '2.7.13',
7+
supportLibVersion: '27.1.1',
8+
gson : '2.8.5',
9+
retrofit : '2.4.0',
10+
okhttp3 : '3.11.0',
11+
mockito : '2.18.3',
1212
hamcrestJunit : '2.0.0.0',
13-
errorprone : '2.0.21',
13+
errorprone : '2.3.1',
1414
]
1515

1616
pluginVersion = [
17-
checkstyle : '7.8.2',
18-
pmd : '5.8.1',
19-
jacoco : '0.7.9',
20-
errorprone : '0.0.10',
21-
coveralls : '2.8.1',
17+
checkstyle : '8.11.0',
18+
jacoco : '0.8.1',
19+
errorprone : '0.0.14',
2220
spotbugs : '1.3',
2321
sonarqube : '2.5',
2422
buildConfig: '1.1.8',

services-directions/src/test/java/com/mapbox/api/directions/v5/MapboxDirectionsTest.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.junit.rules.ExpectedException;
2121

2222
import java.io.IOException;
23+
import java.net.URLEncoder;
2324
import java.util.ArrayList;
2425
import java.util.List;
2526
import java.util.Locale;
@@ -299,8 +300,8 @@ public void annotations_doesGetFormattedInUrlCorrectly() throws Exception {
299300
.overview(DirectionsCriteria.OVERVIEW_FULL)
300301
.accessToken(ACCESS_TOKEN)
301302
.build();
302-
assertTrue(directions.cloneCall().request().url().toString()
303-
.contains("annotations=congestion,duration"));
303+
assertEquals("congestion,duration",
304+
directions.cloneCall().request().url().queryParameter("annotations"));
304305
}
305306

306307
@Test
@@ -312,7 +313,8 @@ public void addBearing_doesGetFormattedInUrlCorrectly() throws Exception {
312313
.addBearing(2d, 90d)
313314
.accessToken(ACCESS_TOKEN)
314315
.build();
315-
assertTrue(directions.cloneCall().request().url().toString().contains("bearings=45,90;2,90"));
316+
assertEquals("45,90;2,90",
317+
directions.cloneCall().request().url().queryParameter("bearings"));
316318
}
317319

318320
@Test
@@ -323,7 +325,8 @@ public void radiuses_doesGetFormattedInUrlCorrectly() throws Exception {
323325
.radiuses(23, 30)
324326
.accessToken(ACCESS_TOKEN)
325327
.build();
326-
assertTrue(directions.cloneCall().request().url().toString().contains("radiuses=23;30"));
328+
assertEquals("23;30",
329+
directions.cloneCall().request().url().queryParameter("radiuses"));
327330
}
328331

329332
@Test
@@ -458,8 +461,8 @@ public void testRadiusWithUnlimitedDistance() throws IOException {
458461
.radiuses(100, Double.POSITIVE_INFINITY, 100)
459462
.build();
460463

461-
assertThat(client.cloneCall().request().url().toString(),
462-
containsString("radiuses=100;unlimited;100"));
464+
assertEquals("100;unlimited;100",
465+
client.cloneCall().request().url().queryParameter("radiuses"));
463466
}
464467

465468
@Test
@@ -576,8 +579,9 @@ public void sanityApproachesInstructions() throws Exception {
576579
.accessToken(ACCESS_TOKEN)
577580
.build();
578581
assertNotNull(mapboxDirections);
579-
assertTrue(mapboxDirections.cloneCall().request().url().toString()
580-
.contains("approaches=unrestricted;;;curb"));
582+
583+
assertEquals("unrestricted;;;curb",
584+
mapboxDirections.cloneCall().request().url().queryParameter("approaches"));
581585
}
582586

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

643-
assertEquals("unrestricted;curb", routeOptions.approaches());
647+
648+
String approaches = routeOptions.approaches();
649+
assertEquals("unrestricted;curb", approaches);
644650
}
645651

646652
@Test
@@ -654,8 +660,8 @@ public void sanityWaypointNamesInstructions() throws Exception {
654660
.accessToken(ACCESS_TOKEN)
655661
.build();
656662
assertNotNull(mapboxDirections);
657-
assertTrue(mapboxDirections.cloneCall().request().url().toString()
658-
.contains("waypoint_names=Home;Store;Work"));
663+
assertEquals("Home;Store;Work",
664+
mapboxDirections.cloneCall().request().url().queryParameter("waypoint_names"));
659665
}
660666

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

683-
StringBuffer longWpName = new StringBuffer();
689+
StringBuilder longWpName = new StringBuilder();
684690
for (int i = 0; i < 124; i++) {
685691
longWpName.append("Home");
686692
}

services-geocoding/src/test/java/com/mapbox/api/geocoding/v5/MapboxGeocodingTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public void country_localeCountryHandlesMultipleCountriesCorrectly() throws Exce
132132
.country(Locale.CANADA)
133133
.query(Point.fromLngLat(-77.03655, 38.89770))
134134
.build();
135-
assertTrue(mapboxGeocoding.cloneCall().request().url().toString().contains("country=US,CA"));
135+
assertEquals("US,CA",
136+
mapboxGeocoding.cloneCall().request().url().queryParameter("country"));
136137
}
137138

138139
@Test
@@ -143,8 +144,8 @@ public void proximity_doesGetAddedToUrlCorrectly() throws Exception {
143144
.query("1600 pennsylvania ave nw")
144145
.proximity(Point.fromLngLat(-77.03655, 38.89770))
145146
.build();
146-
assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
147-
.contains("proximity=-77.03655,38.8977"));
147+
assertEquals("-77.03655,38.8977",
148+
mapboxGeocoding.cloneCall().request().url().queryParameter("proximity"));
148149
}
149150

150151
@Test
@@ -155,8 +156,8 @@ public void geocodingTypes_getsAddedToUrlCorrectly() throws Exception {
155156
.geocodingTypes(GeocodingCriteria.TYPE_COUNTRY, GeocodingCriteria.TYPE_DISTRICT)
156157
.query("1600 pennsylvania ave nw")
157158
.build();
158-
assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
159-
.contains("types=country,district"));
159+
assertEquals("country,district",
160+
mapboxGeocoding.cloneCall().request().url().queryParameter("types"));
160161
}
161162

162163
@Test
@@ -182,8 +183,8 @@ public void bbox_getsFormattedCorrectlyForUrl() throws Exception {
182183
)
183184
.query("1600 pennsylvania ave nw")
184185
.build();
185-
assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
186-
.contains("bbox=-77.083056,38.908611,-76.997778,38.959167"));
186+
assertEquals("-77.083056,38.908611,-76.997778,38.959167",
187+
mapboxGeocoding.cloneCall().request().url().queryParameter("bbox"));
187188
}
188189

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

212214
@Test

services-geocoding/src/test/java/com/mapbox/api/geocoding/v5/models/CarmenContextTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.hamcrest.Matchers.equalTo;
44
import static org.junit.Assert.assertEquals;
55
import static org.junit.Assert.assertNotNull;
6+
import static org.junit.Assert.assertNull;
67
import static org.junit.Assert.assertThat;
78
import static org.junit.Assert.assertTrue;
89

@@ -31,7 +32,7 @@ public void id_returnsCorrectString() throws Exception {
3132
.baseUrl(mockUrl.toString())
3233
.build();
3334
GeocodingResponse response = mapboxGeocoding.executeCall().body();
34-
assert response != null;
35+
assertNotNull(response);
3536
assertThat(response.features().get(0).context().get(0).id(), equalTo("neighborhood.291451"));
3637
}
3738

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

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

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

services-geocoding/src/test/java/com/mapbox/api/geocoding/v5/models/CarmenFeatureTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static org.hamcrest.core.IsEqual.equalTo;
99
import static org.hamcrest.junit.MatcherAssert.assertThat;
1010
import static org.junit.Assert.assertFalse;
11+
import static org.junit.Assert.assertNotNull;
1112

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

6465
GeocodingResponse response = mapboxGeocoding.executeCall().body();
65-
assert response != null;
66+
assertNotNull(response);
6667
CarmenFeature feature = response.features().get(0);
6768
assertThat(feature.geometry(), notNullValue());
6869
assertTrue(feature.geometry() instanceof Point);
@@ -114,7 +115,7 @@ public void toJson_handlesConversionCorrectly() throws IOException {
114115
.baseUrl(mockUrl.toString())
115116
.build();
116117
GeocodingResponse response = mapboxGeocoding.executeCall().body();
117-
assert response != null;
118+
assertNotNull(response);
118119
CarmenFeature feature = response.features().get(0);
119120
compareJson(json, feature.toJson());
120121
}
@@ -130,8 +131,7 @@ public void ForwardGeocode_withValidChineseResponse() throws Exception {
130131
Response<GeocodingResponse> response = mapboxGeocoding.executeCall();
131132
assertEquals(200, response.code());
132133
GeocodingResponse object = response.body();
133-
assert object != null;
134-
134+
assertNotNull(object);
135135
CarmenFeature feature = object.features().get(0);
136136

137137
assertEquals(1, object.query().size());

services-geocoding/src/test/java/com/mapbox/api/geocoding/v5/models/GeocodingResponseTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.hamcrest.Matchers.equalTo;
44
import static org.hamcrest.Matchers.notNullValue;
55
import static org.junit.Assert.assertEquals;
6+
import static org.junit.Assert.assertNotNull;
67
import static org.junit.Assert.assertThat;
78

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

8889
assertEquals(4, object.query().size());
8990
assertThat(object.query().get(0), equalTo("sandy"));

services-geojson/src/test/java/com/mapbox/geojson/utils/PolylineUtilsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void simplify_withHighestQuality() throws IOException{
150150

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

155155
final List<Point> pointList = new ArrayList<>();
156156
for(int i= 0;i <= coords.length-2;i = i+2) {

services-matching/src/main/java/com/mapbox/api/matching/v5/MapboxMapMatching.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ private List<MapMatchingMatching> generateRouteOptions(Response<MapMatchingRespo
232232
}
233233

234234
private static List<Point> formatCoordinates(String coordinates) {
235-
String[] coordPairs = coordinates.split(";");
235+
String[] coordPairs = coordinates.split(";", -1);
236236
List<Point> coordinatesFormatted = new ArrayList<>();
237237
for (String coordPair : coordPairs) {
238-
String[] coords = coordPair.split(",");
238+
String[] coords = coordPair.split(",", -1);
239239
coordinatesFormatted.add(
240240
Point.fromLngLat(Double.valueOf(coords[0]), Double.valueOf(coords[1])));
241241

services-matching/src/test/java/com/mapbox/api/matching/v5/MapboxMapMatchingTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ public void radiuses_doesShowInUrlCorrectly() throws Exception {
298298
.accessToken(ACCESS_TOKEN)
299299
.radiuses(1d, 2d, 3d)
300300
.build();
301-
assertTrue(mapMatching.cloneCall().request().url().toString()
302-
.contains("radiuses=1.0;2.0;3.0"));
301+
assertEquals("1.0;2.0;3.0",
302+
mapMatching.cloneCall().request().url().queryParameter("radiuses"));
303303
}
304304

305305
@Test
@@ -340,8 +340,8 @@ public void timestamps_doesShowInUrlCorrectly() throws Exception {
340340
.accessToken(ACCESS_TOKEN)
341341
.timestamps("1", "2", "3")
342342
.build();
343-
assertTrue(mapMatching.cloneCall().request().url().toString()
344-
.contains("timestamps=1;2;3"));
343+
assertEquals("1;2;3",
344+
mapMatching.cloneCall().request().url().queryParameter("timestamps"));
345345
}
346346

347347
@Test
@@ -356,8 +356,8 @@ public void annotations_doesShowInUrlCorrectly() throws Exception {
356356
DirectionsCriteria.ANNOTATION_DISTANCE,
357357
DirectionsCriteria.ANNOTATION_CONGESTION
358358
).build();
359-
assertTrue(mapMatching.cloneCall().request().url().toString()
360-
.contains("annotations=distance,congestion"));
359+
assertEquals("distance,congestion",
360+
mapMatching.cloneCall().request().url().queryParameter("annotations"));
361361
}
362362

363363
@Test
@@ -543,8 +543,8 @@ public void sanityApproachesInstructions() throws Exception {
543543
.accessToken(ACCESS_TOKEN)
544544
.build();
545545
assertNotNull(mapMatching);
546-
assertTrue(mapMatching.cloneCall().request().url().toString()
547-
.contains("approaches=unrestricted;;;curb"));
546+
assertEquals("unrestricted;;;curb",
547+
mapMatching.cloneCall().request().url().queryParameter("approaches"));
548548
}
549549

550550
@Test
@@ -635,8 +635,8 @@ public void sanityWaypointNamesInstructions() throws Exception {
635635
.addWaypointNames("Home", "Store", "Work")
636636
.build();
637637
assertNotNull(mapMatching);
638-
assertTrue(mapMatching.cloneCall().request().url().toString()
639-
.contains("waypoint_names=Home;Store;Work"));
638+
assertEquals("Home;Store;Work",
639+
mapMatching.cloneCall().request().url().queryParameter("waypoint_names"));
640640
}
641641

642642
@Test
@@ -664,7 +664,7 @@ public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception
664664
thrown.expectMessage(
665665
startsWith("Waypoint names exceed 500 character limit"));
666666

667-
StringBuffer longWpName = new StringBuffer();
667+
StringBuilder longWpName = new StringBuilder();
668668
for (int i = 0; i < 124; i++) {
669669
longWpName.append("Home");
670670
}

services-speech/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies {
88

99
// AutoValue
1010
compileOnly dependenciesList.autoValue
11+
compileOnly dependenciesList.autoValueGson
1112

1213
// Test Dependencies
1314
testImplementation dependenciesList.okhttp3Mockwebserver

0 commit comments

Comments
 (0)