diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 00000000..50387435
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
index a55e7a17..79ee123c 100644
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleFile.java b/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleFile.java
index 13e16130..ac61b7cc 100644
--- a/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleFile.java
+++ b/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleFile.java
@@ -28,6 +28,10 @@ enum GtfsScheduleFile {
private final Presence presence;
public enum Presence {
- REQUIRED, OPTIONAL, CONDITIONALLY_REQUIRED, CONDITIONALLY_FORBIDDEN, RECOMMENDED
+ REQUIRED,
+ OPTIONAL,
+ CONDITIONALLY_REQUIRED,
+ CONDITIONALLY_FORBIDDEN,
+ RECOMMENDED
}
}
diff --git a/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleReader.java b/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleReader.java
index 9f364bd0..d8aa3908 100644
--- a/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleReader.java
+++ b/src/main/java/ch/naviqore/gtfs/schedule/GtfsScheduleReader.java
@@ -10,11 +10,7 @@
import org.apache.commons.io.ByteOrderMark;
import org.apache.commons.io.input.BOMInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
+import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -65,7 +61,8 @@ private static void readFromZip(File zipFile, GtfsScheduleParser parser) throws
readCsvRecords(reader, parser, fileType);
}
} else if (fileType.getPresence() == GtfsScheduleFile.Presence.REQUIRED) {
- throw new FileNotFoundException("Required GTFS CSV file" + fileType.getFileName() + " not found in ZIP");
+ throw new FileNotFoundException(
+ "Required GTFS CSV file" + fileType.getFileName() + " not found in ZIP");
}
}
}
diff --git a/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTest.java b/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTest.java
index 573a1fba..5e5a5cdc 100644
--- a/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTest.java
+++ b/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTest.java
@@ -20,8 +20,13 @@ class GtfsScheduleTest {
@BeforeEach
void setUp(GtfsScheduleTestBuilder builder) {
- schedule = builder.withAddAgency().withAddCalendars().withAddCalendarDates().withAddInterCity()
- .withAddUnderground().withAddBus().build();
+ schedule = builder.withAddAgency()
+ .withAddCalendars()
+ .withAddCalendarDates()
+ .withAddInterCity()
+ .withAddUnderground()
+ .withAddBus()
+ .build();
}
@Nested
@@ -63,13 +68,15 @@ void shouldFindStopWithin1Meter() {
@Test
void shouldFindStopsWithin10000Meters() {
- assertThat(schedule.getNearestStops(47.5, 8.5, 10000)).hasSize(3).extracting("id")
+ assertThat(schedule.getNearestStops(47.5, 8.5, 10000)).hasSize(3)
+ .extracting("id")
.containsOnly("u6", "s2", "u3");
}
@Test
void shouldFindAllStops() {
- assertThat(schedule.getNearestStops(47.5, 8.5, Integer.MAX_VALUE)).hasSize(9).extracting("id")
+ assertThat(schedule.getNearestStops(47.5, 8.5, Integer.MAX_VALUE)).hasSize(9)
+ .extracting("id")
.containsOnly("s1", "s2", "s3", "u1", "u2", "u3", "u4", "u5", "u6");
}
@@ -90,7 +97,8 @@ private static void assertWeekendAndHoliday(List departures) {
List expectedDepartures = List.of(ServiceDayTime.parse("08:15:00"),
ServiceDayTime.parse("08:15:00"), ServiceDayTime.parse("09:15:00"),
ServiceDayTime.parse("09:15:00"), ServiceDayTime.parse("10:15:00"));
- assertThat(departures).hasSize(LIMIT).extracting(StopTime::departure)
+ assertThat(departures).hasSize(LIMIT)
+ .extracting(StopTime::departure)
.containsExactlyElementsOf(expectedDepartures);
// assert trips are correct
@@ -114,7 +122,8 @@ void shouldReturnNextDeparturesOnWeekday() {
List expectedDepartures = List.of(ServiceDayTime.parse("08:00:00"),
ServiceDayTime.parse("08:00:00"), ServiceDayTime.parse("08:09:00"),
ServiceDayTime.parse("08:09:00"), ServiceDayTime.parse("08:15:00"));
- assertThat(departures).hasSize(LIMIT).extracting(StopTime::departure)
+ assertThat(departures).hasSize(LIMIT)
+ .extracting(StopTime::departure)
.containsExactlyElementsOf(expectedDepartures);
// assert trips are correct
@@ -154,7 +163,8 @@ void shouldReturnNextDeparturesAfterMidnight() {
List expectedDepartures = List.of(ServiceDayTime.parse("24:00:00"),
ServiceDayTime.parse("24:00:00"), ServiceDayTime.parse("24:09:00"),
ServiceDayTime.parse("24:09:00"), ServiceDayTime.parse("24:15:00"));
- assertThat(departures).hasSize(LIMIT).extracting(StopTime::departure)
+ assertThat(departures).hasSize(LIMIT)
+ .extracting(StopTime::departure)
.containsExactlyElementsOf(expectedDepartures);
// assert trips are correct
@@ -186,7 +196,8 @@ void shouldReturnNoDeparturesFromUnknownStop() {
class ActiveTrips {
private static void assertWeekendAndHoliday(List activeTrips) {
- assertThat(activeTrips).hasSize(168).extracting(trip -> trip.getRoute().getId())
+ assertThat(activeTrips).hasSize(168)
+ .extracting(trip -> trip.getRoute().getId())
.containsAll(Set.of("route1", "route2"));
}
@@ -195,7 +206,8 @@ void shouldReturnActiveTripsOnWeekday() {
List activeTrips = schedule.getActiveTrips(
GtfsScheduleTestBuilder.Moments.WEEKDAY_8_AM.toLocalDate());
- assertThat(activeTrips).hasSize(503).extracting(trip -> trip.getRoute().getId())
+ assertThat(activeTrips).hasSize(503)
+ .extracting(trip -> trip.getRoute().getId())
.containsAll(Set.of("route1", "route2", "route3"));
}
diff --git a/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTestBuilder.java b/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTestBuilder.java
index 8c77bec1..2c9b06a1 100644
--- a/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTestBuilder.java
+++ b/src/test/java/ch/naviqore/gtfs/schedule/model/GtfsScheduleTestBuilder.java
@@ -1,23 +1,13 @@
package ch.naviqore.gtfs.schedule.model;
-import ch.naviqore.gtfs.schedule.type.DefaultRouteType;
-import ch.naviqore.gtfs.schedule.type.ExceptionType;
-import ch.naviqore.gtfs.schedule.type.HierarchicalVehicleType;
-import ch.naviqore.gtfs.schedule.type.RouteType;
-import ch.naviqore.gtfs.schedule.type.ServiceDayTime;
+import ch.naviqore.gtfs.schedule.type.*;
import lombok.NoArgsConstructor;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
/**
* Test builder to set up a GTFS schedule for testing purposes.
@@ -105,7 +95,6 @@ public GtfsScheduleTestBuilder withAddInterCity() {
return this;
}
-
public GtfsScheduleTestBuilder withAddUnderground() {
addRoute(ROUTES.get(1), true, false);
return this;
@@ -120,7 +109,6 @@ public GtfsSchedule build() {
return builder.build();
}
-
private void addRoute(Route route, boolean everydayService, boolean bidirectional) {
builder.addRoute(route.id, route.agencyId, route.name, route.name + "long", route.routeType);
addStops(route);