fix: preserve mileage metadata on location events

This commit is contained in:
lingniu
2026-07-01 10:00:38 +08:00
parent 136b8a040c
commit da17acb09a
4 changed files with 37 additions and 2 deletions

View File

@@ -42,6 +42,12 @@ class Gb32960EventMapperTest {
assertThat(events).anyMatch(e -> e instanceof VehicleEvent.Location);
assertThat(events).allMatch(e -> e.source() == ProtocolId.GB32960);
assertThat(events).allMatch(e -> e.vin().equals("LTEST000000000002"));
VehicleEvent.Location location = events.stream()
.filter(VehicleEvent.Location.class::isInstance)
.map(VehicleEvent.Location.class::cast)
.findFirst()
.orElseThrow();
assertThat(location.metadata()).containsEntry("total_mileage_km", "123456.7");
}
@Test