Skip to content

Commit

Permalink
Move tests into packages
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed May 27, 2024
1 parent 8c9d8e7 commit 1252e78
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.opentripplanner.updater.trip.moduletests;
package org.opentripplanner.updater.trip.moduletests.cancellation;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.google.transit.realtime.GtfsRealtime.TripDescriptor.ScheduleRelationship;
import java.util.List;
Expand All @@ -14,7 +15,11 @@
import org.opentripplanner.updater.trip.GtfsRealtimeTestEnvironment;
import org.opentripplanner.updater.trip.TripUpdateBuilder;

public class A01_CancellationDeletionTest {
/**
* Cancellations and deletions should end up in the internal data model and make trips unavailable
* for routing.
*/
public class CancellationDeletionTest {

static List<Arguments> cases() {
return List.of(
Expand Down Expand Up @@ -51,5 +56,6 @@ public void cancelledTrip(ScheduleRelationship relationship, RealTimeState state
var tripTimes = forToday.getTripTimes(tripIndex1);

assertEquals(state, tripTimes.getRealTimeState());
assertTrue(tripTimes.isCanceledOrDeleted());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.opentripplanner.updater.trip.moduletests;
package org.opentripplanner.updater.trip.moduletests.delay;

import static com.google.transit.realtime.GtfsRealtime.TripDescriptor.ScheduleRelationship.SCHEDULED;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -12,7 +12,7 @@
import org.opentripplanner.updater.trip.GtfsRealtimeTestEnvironment;
import org.opentripplanner.updater.trip.TripUpdateBuilder;

public class B01_DelayedTest {
public class DelayedTest {

@Test
public void delayed() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.opentripplanner.updater.trip.moduletests;
package org.opentripplanner.updater.trip.moduletests.delay;

import static com.google.transit.realtime.GtfsRealtime.TripDescriptor.ScheduleRelationship.SCHEDULED;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -17,7 +17,7 @@
import org.opentripplanner.updater.trip.GtfsRealtimeTestEnvironment;
import org.opentripplanner.updater.trip.TripUpdateBuilder;

public class B02_SkippedTest {
public class SkippedTest {

@Test
public void scheduledTripWithSkippedAndScheduled() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.opentripplanner.updater.trip.moduletests;
package org.opentripplanner.updater.trip.moduletests.rejection;

import static com.google.transit.realtime.GtfsRealtime.TripDescriptor.ScheduleRelationship.SCHEDULED;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -10,21 +10,19 @@
import org.opentripplanner.updater.trip.GtfsRealtimeTestEnvironment;
import org.opentripplanner.updater.trip.TripUpdateBuilder;

public class C01_InvalidInputTest {
/**
* A trip with start date that is outside the service period shouldn't throw an exception and is
* ignored instead.
*/
public class InvalidInputTest {

/**
* This test asserts that trip with start date that is outside the service period doesn't
* throw an exception and is ignored instead.
*/
@Test
public void invalidTripDate() {
var env = new GtfsRealtimeTestEnvironment();

String scheduledTripId = env.trip1.getId().getId();

var serviceDateOutsideService = env.serviceDate.minusYears(10);
var builder = new TripUpdateBuilder(
scheduledTripId,
env.trip1.getId().getId(),
serviceDateOutsideService,
SCHEDULED,
env.timeZone
Expand Down

0 comments on commit 1252e78

Please sign in to comment.