|
2 | 2 |
|
3 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | 4 | import static org.junit.jupiter.api.Assertions.assertFalse; |
5 | | -import static org.junit.jupiter.api.Assertions.assertNull; |
6 | 5 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertNull; |
7 | 7 | import static org.junit.jupiter.api.Assertions.assertTrue; |
8 | 8 | import static org.opentripplanner.StationParameters.OSLO_EAST; |
9 | 9 | import static org.opentripplanner.StationParameters.OSLO_LUFTHAVN_ID; |
@@ -318,39 +318,41 @@ public void modes(Set<RequestMode> modes) throws IOException { |
318 | 318 |
|
319 | 319 | @Test |
320 | 320 | public void pageCursor() throws IOException { |
321 | | - var params = TripPlanParameters.builder() |
322 | | - .withFrom(OSLO_WEST) |
323 | | - .withTo(OSLO_EAST) |
324 | | - .withModes(RequestMode.TRANSIT, RequestMode.WALK) |
325 | | - .withTime(LocalDateTime.now()); |
326 | | - |
327 | | - var initialResult = client.plan(params.build()); |
328 | | - LOG.info("Initial page has {} results", initialResult.itineraries().size()); |
329 | | - assertFalse(initialResult.itineraries().isEmpty()); |
330 | | - |
331 | | - var nextResult = client.plan(params.withPageCursor(initialResult.nextPageCursor()).build()); |
332 | | - LOG.info("Next page has {} results", nextResult.itineraries().size()); |
333 | | - assertFalse(nextResult.itineraries().isEmpty()); |
334 | | - |
335 | | - var prevResult = client.plan(params.withPageCursor(initialResult.previousPageCursor()).build()); |
336 | | - LOG.info("Prev page has {} results", prevResult.itineraries().size()); |
337 | | - assertFalse(prevResult.itineraries().isEmpty()); |
| 321 | + var params = |
| 322 | + TripPlanParameters.builder() |
| 323 | + .withFrom(OSLO_WEST) |
| 324 | + .withTo(OSLO_EAST) |
| 325 | + .withModes(RequestMode.TRANSIT, RequestMode.WALK) |
| 326 | + .withTime(LocalDateTime.now()); |
| 327 | + |
| 328 | + var initialResult = client.plan(params.build()); |
| 329 | + LOG.info("Initial page has {} results", initialResult.itineraries().size()); |
| 330 | + assertFalse(initialResult.itineraries().isEmpty()); |
| 331 | + |
| 332 | + var nextResult = client.plan(params.withPageCursor(initialResult.nextPageCursor()).build()); |
| 333 | + LOG.info("Next page has {} results", nextResult.itineraries().size()); |
| 334 | + assertFalse(nextResult.itineraries().isEmpty()); |
| 335 | + |
| 336 | + var prevResult = client.plan(params.withPageCursor(initialResult.previousPageCursor()).build()); |
| 337 | + LOG.info("Prev page has {} results", prevResult.itineraries().size()); |
| 338 | + assertFalse(prevResult.itineraries().isEmpty()); |
338 | 339 | } |
339 | 340 |
|
340 | | - @Test |
341 | | - public void nullPageCursor() throws IOException { |
342 | | - var params = TripPlanParameters.builder() |
343 | | - .withFrom(OSLO_WEST) |
344 | | - .withTo(new Coordinate(0, 0)) |
345 | | - .withModes(RequestMode.TRANSIT) |
346 | | - .withTime(LocalDateTime.now()); |
347 | | - |
348 | | - var result = client.plan(params.build()); |
349 | | - LOG.info("Result {}", result); |
350 | | - assertTrue(result.itineraries().isEmpty()); |
351 | | - assertNull(result.nextPageCursor()); |
352 | | - assertNull(result.previousPageCursor()); |
353 | | - } |
| 341 | + @Test |
| 342 | + public void nullPageCursor() throws IOException { |
| 343 | + var params = |
| 344 | + TripPlanParameters.builder() |
| 345 | + .withFrom(OSLO_WEST) |
| 346 | + .withTo(new Coordinate(0, 0)) |
| 347 | + .withModes(RequestMode.TRANSIT) |
| 348 | + .withTime(LocalDateTime.now()); |
| 349 | + |
| 350 | + var result = client.plan(params.build()); |
| 351 | + LOG.info("Result {}", result); |
| 352 | + assertTrue(result.itineraries().isEmpty()); |
| 353 | + assertNull(result.nextPageCursor()); |
| 354 | + assertNull(result.previousPageCursor()); |
| 355 | + } |
354 | 356 |
|
355 | 357 | @Test |
356 | 358 | public void rentalStations() throws IOException { |
|
0 commit comments