Skip to content

Commit

Permalink
Merge pull request #5415 from entur/fix_query_with_empty_quay_id
Browse files Browse the repository at this point in the history
Fix Transmodel GraphQL query with empty quay id
  • Loading branch information
vpaturet authored Oct 13, 2023
2 parents acc39ba + 059cc9d commit 5c5d08f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ private void reindex() {
@Nullable
@SafeVarargs
private static <V> V getById(FeedScopedId id, Map<FeedScopedId, ? extends V>... maps) {
if (id == null) {
return null;
}
for (Map<FeedScopedId, ? extends V> map : maps) {
V v = map.get(id);
if (v != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;
Expand Down Expand Up @@ -132,4 +133,10 @@ void testGroupOfStations() {
assertEquals(COOR_B, m.getCoordinateById(ID));
assertFalse(m.hasAreaStops());
}

@Test
void testNullStopLocationId() {
var m = StopModel.of().build();
assertNull(m.getStopLocation(null));
}
}

0 comments on commit 5c5d08f

Please sign in to comment.