Skip to content

Commit 4f3648d

Browse files
Make leg's startTime, endTime, serviceDate required
1 parent 4738e85 commit 4f3648d

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/model/ConsolidatedStopLegBuilderTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;
66

77
import java.time.LocalDate;
8+
import java.time.ZonedDateTime;
89
import java.util.List;
910
import java.util.Set;
1011
import org.junit.jupiter.api.Test;
@@ -21,6 +22,7 @@
2122

2223
class ConsolidatedStopLegBuilderTest implements PlanTestConstants {
2324

25+
private static final ZonedDateTime TIME = ZonedDateTime.parse("2025-06-25T08:33:36+02:00");
2426
private static final Set<TransitAlert> ALERTS = Set.of(
2527
TransitAlert.of(id("alert")).withDescriptionText(I18NString.of("alert")).build()
2628
);
@@ -35,6 +37,9 @@ class ConsolidatedStopLegBuilderTest implements PlanTestConstants {
3537
.withBoardStopIndexInPattern(0)
3638
.withDistanceMeters(1000)
3739
.withAlightStopIndexInPattern(1)
40+
.withStartTime(TIME)
41+
.withEndTime(TIME)
42+
.withServiceDate(TIME.toLocalDate())
3843
.build();
3944
private static final List<FareProductUse> FARES = List.of(FARE_PRODUCT_USE);
4045

application/src/main/java/org/opentripplanner/model/plan/leg/ScheduledTransitLeg.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,9 @@ protected ScheduledTransitLeg(ScheduledTransitLegBuilder<?> builder) {
9494
"alightStopPosInPattern"
9595
);
9696

97-
// TODO - Add requireNonNull for start-time. Some tests fails when this is done, these tests
98-
// should be fixed.
99-
this.startTime = builder.startTime();
100-
// TODO - Add requireNonNull for end-tTime. Some tests fails when this is done, these tests
101-
// should be fixed.
102-
this.endTime = builder.endTime();
103-
104-
// TODO - Add requireNonNull for service-date. Some tests fails when this is done, these tests
105-
// should be fixed.
106-
this.serviceDate = builder.serviceDate();
97+
this.startTime = Objects.requireNonNull(builder.startTime());
98+
this.endTime = Objects.requireNonNull(builder.endTime());
99+
this.serviceDate = Objects.requireNonNull(builder.serviceDate());
107100
this.zoneId = Objects.requireNonNull(builder.zoneId());
108101

109102
this.tripOnServiceDate = builder.tripOnServiceDate();

application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSchedule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
public class TestTripSchedule implements TripSchedule {
2626

2727
private static final int DEFAULT_DEPARTURE_DELAY = 10;
28+
private static final LocalDate DATE = LocalDate.of(2025, 6, 25);
2829
private final DefaultTripPattern pattern;
2930
private final int[] arrivalTimes;
3031
private final int[] departureTimes;
@@ -113,7 +114,7 @@ public String toString() {
113114

114115
@Override
115116
public LocalDate getServiceDate() {
116-
return null;
117+
return DATE;
117118
}
118119

119120
@Override

0 commit comments

Comments
 (0)