fix: null in unit testing

This commit is contained in:
js0ny 2025-12-06 11:25:23 +00:00
parent b8fd649ccf
commit 9e2b38e205
2 changed files with 19 additions and 3 deletions

View file

@ -2,7 +2,21 @@ FROM maven:3.9.9-amazoncorretto-21-debian AS build
WORKDIR /app WORKDIR /app
COPY ./build/libs/ilp-coursework-0.0.1-SNAPSHOT.jar app.jar COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
RUN chmod +x gradlew
COPY src src
RUN ./gradlew build -x test --no-daemon
FROM amazoncorretto:21-alpine
WORKDIR /app
COPY --from=builder /app/build/libs/*.jar app.jar
EXPOSE 8080 EXPOSE 8080

View file

@ -63,7 +63,7 @@ public class PathFinderService {
private final Map<Integer, LngLat> servicePointLocations; private final Map<Integer, LngLat> servicePointLocations;
private final List<Region> restrictedRegions; private final List<Region> restrictedRegions;
@Autowired @Autowired(required = false)
private TelemetryService telemetryService; private TelemetryService telemetryService;
/** /**
@ -182,7 +182,9 @@ public class PathFinderService {
var resp = new DeliveryPathResponse(totalCost, totalMoves, paths.toArray(new DronePath[0])); var resp = new DeliveryPathResponse(totalCost, totalMoves, paths.toArray(new DronePath[0]));
telemetryService.sendEventAsyncByPathResponse(resp, deliveryTimestamps); if (telemetryService != null) {
telemetryService.sendEventAsyncByPathResponse(resp, deliveryTimestamps);
}
return resp; return resp;
} }