@@ -35,6 +35,7 @@ public static GHMRequest createRequest() {
35
35
new GHPoint (51.473685 , -0.211487 )
36
36
));
37
37
req .setOutArrays (Arrays .asList ("weights" ));
38
+ req .setProfile ("car" );
38
39
return req ;
39
40
}
40
41
@@ -80,6 +81,7 @@ public void testReadingMatrixConnectionsNotFound_noFailFast() throws IOException
80
81
));
81
82
req .setOutArrays (Arrays .asList ("weights" , "distances" , "times" ));
82
83
req .setFailFast (false );
84
+ req .setProfile ("car" );
83
85
84
86
MatrixResponse rsp = matrixWeb .route (req );
85
87
assertFalse (rsp .hasErrors ());
@@ -108,6 +110,7 @@ public void testReadingMatrixPointsNotFound_noFailFast() throws IOException {
108
110
new GHPoint (2 , 3 ),
109
111
new GHPoint (4 , 5 )
110
112
));
113
+ req .setProfile ("car" );
111
114
req .setOutArrays (Arrays .asList ("weights" , "distances" , "times" ));
112
115
req .setFailFast (false );
113
116
@@ -187,19 +190,32 @@ public void testReadingWeights_TimesAndDistances() throws IOException {
187
190
@ Test
188
191
public void noProfileWhenNotSpecified () {
189
192
GHMatrixBatchRequester requester = new GHMatrixBatchRequester ("url" );
190
- JsonNode json = requester .createPostRequest (new GHMRequest ().setOutArrays (Collections .singletonList ("weights" )).setPoints (Arrays .asList (new GHPoint (11 , 12 ))));
191
- assertEquals ("{\" points\" :[[12.0,11.0]],\" out_arrays\" :[\" weights\" ],\" fail_fast\" :true}" , json .toString ());
193
+ JsonNode json = requester .createPostRequest (new GHMRequest ().setOutArrays (Collections .singletonList ("weights" )).
194
+ setPoints (Arrays .asList (new GHPoint (11 , 12 ))).setProfile ("car" ));
195
+ assertEquals ("{\" points\" :[[12.0,11.0]],\" out_arrays\" :[\" weights\" ],\" fail_fast\" :true,\" profile\" :\" car\" }" , json .toString ());
196
+ }
197
+
198
+ @ Test
199
+ public void hasProfile () {
200
+ GHMatrixAbstractRequester requester = createRequester ("url" );
201
+ GHMRequest ghmRequest = new GHMRequest ();
202
+ ghmRequest .setOutArrays (Collections .singletonList ("weights" ));
203
+ ghmRequest .setPoints (Arrays .asList (new GHPoint (11 , 12 )));
204
+ ghmRequest .setProfile ("bike" );
205
+ JsonNode json = requester .createPostRequest (ghmRequest );
206
+ assertEquals ("{\" points\" :[[12.0,11.0]],\" out_arrays\" :[\" weights\" ],\" fail_fast\" :true,\" profile\" :\" bike\" }" , json .toString ());
192
207
}
193
208
194
209
@ Test
195
210
public void hasHintsWhenSpecified () {
196
211
GHMatrixAbstractRequester requester = createRequester ("url" );
197
212
GHMRequest ghmRequest = new GHMRequest ();
213
+ ghmRequest .setProfile ("car" );
198
214
ghmRequest .putHint ("some_property" , "value" );
199
215
ghmRequest .setOutArrays (Collections .singletonList ("weights" ));
200
216
ghmRequest .setPoints (Arrays .asList (new GHPoint (11 , 12 )));
201
217
JsonNode json = requester .createPostRequest (ghmRequest );
202
- assertEquals ("{\" points\" :[[12.0,11.0]],\" out_arrays\" :[\" weights\" ],\" fail_fast\" :true,\" some_property\" :\" value\" }" , json .toString ());
218
+ assertEquals ("{\" points\" :[[12.0,11.0]],\" out_arrays\" :[\" weights\" ],\" fail_fast\" :true,\" profile \" : \" car \" , \" some_property\" :\" value\" }" , json .toString ());
203
219
204
220
ghmRequest .putHint ("profile" , "car" );
205
221
Exception ex = assertThrows (IllegalArgumentException .class , () -> requester .createPostRequest (ghmRequest ));
0 commit comments