Skip to content

Commit 3ba10fd

Browse files
Apply review feedback
1 parent 866f5ef commit 3ba10fd

3 files changed

Lines changed: 23 additions & 22 deletions

File tree

application/src/main/java/org/opentripplanner/gtfs/mapping/NoticeAssignmentMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ Multimap<AbstractTransitEntity, Notice> map(Collection<NoticeAssignment> assignm
4949
.collect(Collectors.toMap(Trip::getId, Function.identity()));
5050
var routes = routeMapper.mappedRoutes();
5151
for (var assignment : assignments) {
52-
mapOne(noticeMapper.mappedNotices(), assignment, trips, routes).ifPresent(entry ->
52+
mapOne(assignment, noticeMapper.mappedNotices(), trips, routes).ifPresent(entry ->
5353
result.put(entry.getKey(), entry.getValue())
5454
);
5555
}
5656
return result;
5757
}
5858

5959
private Optional<Map.Entry<AbstractTransitEntity, Notice>> mapOne(
60-
Map<FeedScopedId, Notice> notices,
6160
NoticeAssignment assignment,
61+
Map<FeedScopedId, Notice> notices,
6262
Map<FeedScopedId, Trip> trips,
6363
Map<FeedScopedId, Route> routes
6464
) {

application/src/test/java/org/opentripplanner/gtfs/mapping/NoticeAssignmentMapperTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.opentripplanner.gtfs.mapping;
22

3+
import static com.google.common.truth.Truth.assertThat;
34
import static org.junit.jupiter.api.Assertions.assertEquals;
4-
import static org.junit.jupiter.api.Assertions.assertTrue;
55
import static org.onebusaway.gtfs.model.AgencyAndIdFactory.obaId;
66

77
import java.util.List;
@@ -111,13 +111,14 @@ void mapNoticeAssignmentOnTrip() {
111111
void missingNoticeLogsIssue() {
112112
var issues = new DefaultDataImportIssueStore();
113113
var noticeMapper = new NoticeMapper(ID_FACTORY);
114+
var routeMapper = createRouteMapper();
114115

115116
var mapper = new NoticeAssignmentMapper(
116117
ID_FACTORY,
117118
issues,
118119
noticeMapper,
119-
createTripMapper(createRouteMapper()),
120-
createRouteMapper()
120+
createTripMapper(routeMapper),
121+
routeMapper
121122
);
122123

123124
var assignment = new NoticeAssignment();
@@ -127,10 +128,9 @@ void missingNoticeLogsIssue() {
127128

128129
var result = mapper.map(List.of(assignment));
129130

130-
assertTrue(result.isEmpty());
131-
assertEquals(
132-
List.of("NoticeAssignmentWithoutNotice"),
133-
issues.listIssues().stream().map(DataImportIssue::getType).toList()
131+
assertThat(result).isEmpty();
132+
assertThat(issues.listIssues().stream().map(DataImportIssue::getType)).containsExactly(
133+
"NoticeAssignmentWithoutNotice"
134134
);
135135
}
136136

@@ -139,13 +139,14 @@ void missingRouteEntityLogsIssue() {
139139
var issues = new DefaultDataImportIssueStore();
140140
var noticeMapper = new NoticeMapper(ID_FACTORY);
141141
noticeMapper.map(GTFS_NOTICE);
142+
var routeMapper = createRouteMapper();
142143

143144
var mapper = new NoticeAssignmentMapper(
144145
ID_FACTORY,
145146
issues,
146147
noticeMapper,
147-
createTripMapper(createRouteMapper()),
148-
createRouteMapper()
148+
createTripMapper(routeMapper),
149+
routeMapper
149150
);
150151

151152
var assignment = new NoticeAssignment();
@@ -155,10 +156,9 @@ void missingRouteEntityLogsIssue() {
155156

156157
var result = mapper.map(List.of(assignment));
157158

158-
assertTrue(result.isEmpty());
159-
assertEquals(
160-
List.of("NoticeAssignmentWithUnknownEntity"),
161-
issues.listIssues().stream().map(DataImportIssue::getType).toList()
159+
assertThat(result).isEmpty();
160+
assertThat(issues.listIssues().stream().map(DataImportIssue::getType).toList()).containsExactly(
161+
"NoticeAssignmentWithUnknownEntity"
162162
);
163163
}
164164

@@ -167,13 +167,14 @@ void missingTripEntityLogsIssue() {
167167
var issues = new DefaultDataImportIssueStore();
168168
var noticeMapper = new NoticeMapper(ID_FACTORY);
169169
noticeMapper.map(GTFS_NOTICE);
170+
var routeMapper = createRouteMapper();
170171

171172
var mapper = new NoticeAssignmentMapper(
172173
ID_FACTORY,
173174
issues,
174175
noticeMapper,
175-
createTripMapper(createRouteMapper()),
176-
createRouteMapper()
176+
createTripMapper(routeMapper),
177+
routeMapper
177178
);
178179

179180
var assignment = new NoticeAssignment();
@@ -183,10 +184,9 @@ void missingTripEntityLogsIssue() {
183184

184185
var result = mapper.map(List.of(assignment));
185186

186-
assertTrue(result.isEmpty());
187-
assertEquals(
188-
List.of("NoticeAssignmentWithUnknownEntity"),
189-
issues.listIssues().stream().map(DataImportIssue::getType).toList()
187+
assertThat(result).isEmpty();
188+
assertThat(issues.listIssues().stream().map(DataImportIssue::getType).toList()).containsExactly(
189+
"NoticeAssignmentWithUnknownEntity"
190190
);
191191
}
192192

application/src/test/java/org/opentripplanner/gtfs/mapping/NoticeMapperTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.opentripplanner.gtfs.mapping;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertNull;
45
import static org.junit.jupiter.api.Assertions.assertSame;
56
import static org.onebusaway.gtfs.model.AgencyAndIdFactory.obaId;
67
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID;
@@ -34,7 +35,7 @@ void testMap() {
3435
@Test
3536
void testPublicCodeIsNull() {
3637
var result = subject.map(GTFS_NOTICE);
37-
assertEquals(null, result.publicCode());
38+
assertNull(result.publicCode());
3839
}
3940

4041
@Test

0 commit comments

Comments
 (0)