Summary
DataCache.findNearby() is the critical data path — it filters permanently closed stations and sorts by distance. It has no tests.
What to test
File: backend/src/main/kotlin/uk/co/fueller/backend/DataCache.kt
| Test |
Description |
findNearby_excludesPermanentlyClosed |
Stations with status=PermanentlyClosed are excluded |
findNearby_sortsByDistance |
Nearest station is first in result |
findNearby_respectsRadiusLimit |
No station beyond radiusMiles appears in result |
findNearby_emptyCache |
Returns empty list gracefully, no exception |
findNearby_postcodeNotFound |
Invalid postcode returns empty list |
Setup
Use a pre-populated in-memory ConcurrentHashMap fixture — no real API calls needed.
Workstream: WS2 Phase 2A
Summary
DataCache.findNearby()is the critical data path — it filters permanently closed stations and sorts by distance. It has no tests.What to test
File:
backend/src/main/kotlin/uk/co/fueller/backend/DataCache.ktfindNearby_excludesPermanentlyClosedstatus=PermanentlyClosedare excludedfindNearby_sortsByDistancefindNearby_respectsRadiusLimitradiusMilesappears in resultfindNearby_emptyCachefindNearby_postcodeNotFoundSetup
Use a pre-populated in-memory
ConcurrentHashMapfixture — no real API calls needed.Workstream: WS2 Phase 2A