diff --git a/accessibility/src/main/java/nu/ndw/nls/accessibilitymap/accessibility/graphhopper/factory/IsochroneServiceFactory.java b/accessibility/src/main/java/nu/ndw/nls/accessibilitymap/accessibility/graphhopper/factory/IsochroneServiceFactory.java index 1e4a0099..77fb535f 100644 --- a/accessibility/src/main/java/nu/ndw/nls/accessibilitymap/accessibility/graphhopper/factory/IsochroneServiceFactory.java +++ b/accessibility/src/main/java/nu/ndw/nls/accessibilitymap/accessibility/graphhopper/factory/IsochroneServiceFactory.java @@ -9,7 +9,7 @@ import lombok.RequiredArgsConstructor; import nu.ndw.nls.accessibilitymap.accessibility.graphhopper.IsochroneService; import nu.ndw.nls.geometry.distance.FractionAndDistanceCalculator; - +import nu.ndw.nls.geometry.factories.GeometryFactoryWgs84; import nu.ndw.nls.routingmapmatcher.isochrone.algorithm.ShortestPathTreeFactory; import nu.ndw.nls.routingmapmatcher.isochrone.mappers.IsochroneMatchMapper; import nu.ndw.nls.routingmapmatcher.network.NetworkGraphHopper; @@ -24,10 +24,12 @@ public class IsochroneServiceFactory { private final FractionAndDistanceCalculator fractionAndDistanceCalculator; + private final GeometryFactoryWgs84 geometryFactory; + public IsochroneService createService(NetworkGraphHopper network) { EncodingManager encodingManager = network.getEncodingManager(); IsochroneMatchMapper isochroneMatchMapper = new IsochroneMatchMapper(encodingManager, - edgeIteratorStateReverseExtractor, new PointListUtil(), fractionAndDistanceCalculator); + edgeIteratorStateReverseExtractor, new PointListUtil(geometryFactory), fractionAndDistanceCalculator); Weighting weighting = network.createWeighting(PROFILE, new PMap()); ShortestPathTreeFactory shortestPathTreeFactory = new ShortestPathTreeFactory(weighting,encodingManager); return new IsochroneService(encodingManager, isochroneMatchMapper, shortestPathTreeFactory); diff --git a/backend/src/main/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerController.java b/backend/src/main/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerController.java index c341c55f..87d344aa 100644 --- a/backend/src/main/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerController.java +++ b/backend/src/main/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerController.java @@ -7,8 +7,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; -import nu.ndw.nls.accessibilitymap.backend.exceptions.IncompleteArgumentsException; import nu.ndw.nls.accessibilitymap.accessibility.exceptions.ResourceNotFoundException; +import nu.ndw.nls.accessibilitymap.backend.exceptions.IncompleteArgumentsException; import nu.ndw.nls.accessibilitymap.backend.exceptions.VehicleTypeNotSupportedException; import nu.ndw.nls.accessibilitymap.backend.exceptions.VehicleWeightRequiredException; import nu.ndw.nls.accessibilitymap.backend.generated.model.v1.APIErrorJson; @@ -60,7 +60,7 @@ public ResponseEntity handleBadRequestException(RuntimeException e public ResponseEntity handleMethodArgumentTypeMismatchException( MethodArgumentTypeMismatchException exception) { APIErrorJson restError = new APIErrorJson() - .message("'" + exception.getPropertyName() + "' " + exception.getMessage()); + .message(exception.getMessage()); return ResponseEntity.badRequest() .body(restError); } diff --git a/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerControllerTest.java b/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerControllerTest.java index 27ffe48f..5d3ed37f 100644 --- a/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerControllerTest.java +++ b/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/controllers/ErrorHandlerControllerTest.java @@ -72,13 +72,12 @@ void handleAccessDenied_ok() { @Test void handleMethodArgumentTypeMismatchException_ok() { - when(methodArgumentTypeMismatchException.getPropertyName()).thenReturn(PROPERTY_NAME); when(methodArgumentTypeMismatchException.getMessage()).thenReturn(MESSAGE); ResponseEntity response = errorHandlerController .handleMethodArgumentTypeMismatchException(methodArgumentTypeMismatchException); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST); assertThat(response.getBody()).isNotNull(); - assertThat(response.getBody().getMessage()).isEqualTo("'" + PROPERTY_NAME + "' " + MESSAGE); + assertThat(response.getBody().getMessage()).isEqualTo(MESSAGE); } @Test diff --git a/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/graphhopper/AccessibilityMapITConfig.java b/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/graphhopper/AccessibilityMapITConfig.java index 2760ea5c..b5d348c4 100644 --- a/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/graphhopper/AccessibilityMapITConfig.java +++ b/backend/src/test/java/nu/ndw/nls/accessibilitymap/backend/graphhopper/AccessibilityMapITConfig.java @@ -27,11 +27,17 @@ public AccessibilityMapFactory accessibilityMapFactory() { RestrictionMapperProvider restrictionMapperProvider = new RestrictionMapperProvider(); VehicleRestrictionsModelFactory vehicleRestrictionsModelFactory = new VehicleRestrictionsModelFactory( restrictionMapperProvider); + EdgeIteratorStateReverseExtractor edgeIteratorStateReverseExtractor = new EdgeIteratorStateReverseExtractor(); GeodeticCalculatorFactory geodeticCalculatorFactory = new GeodeticCalculatorFactory(); IsochroneServiceFactory isochroneServiceFactory = new IsochroneServiceFactory( - edgeIteratorStateReverseExtractor, new FractionAndDistanceCalculator(geodeticCalculatorFactory, - List.of(new GeometryFactoryWgs84()), new BearingCalculator(geodeticCalculatorFactory))); + edgeIteratorStateReverseExtractor, + new FractionAndDistanceCalculator( + geodeticCalculatorFactory, + List.of(new GeometryFactoryWgs84()), + new BearingCalculator(geodeticCalculatorFactory)), + new GeometryFactoryWgs84()); + return new AccessibilityMapFactory(vehicleRestrictionsModelFactory, isochroneServiceFactory); } diff --git a/backend/src/test/resources/test-messages/accessibility/response-400-incorrect-has-trailer.json b/backend/src/test/resources/test-messages/accessibility/response-400-incorrect-has-trailer.json index ce7e4bcd..bed0140f 100644 --- a/backend/src/test/resources/test-messages/accessibility/response-400-incorrect-has-trailer.json +++ b/backend/src/test/resources/test-messages/accessibility/response-400-incorrect-has-trailer.json @@ -1,3 +1,3 @@ { - "message": "'vehicleHasTrailer' Failed to convert value of type 'java.lang.String' to required type 'java.lang.Boolean'; Invalid boolean value [2]" + "message": "Method parameter 'vehicleHasTrailer': Failed to convert value of type 'java.lang.String' to required type 'java.lang.Boolean'; Invalid boolean value [2]" } diff --git a/pom.xml b/pom.xml index 90e723ca..9868ef3c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.4 + 3.3.5 nu.ndw.nls.accessibilitymap parent @@ -22,7 +22,7 @@ 21 - 3.4.1 + 3.5.0 UTF-8 UTF-8 0.2.6 @@ -38,10 +38,10 @@ 1.3.1 2.2.25 5.0.6 - 7.1.4 - 5.0.7 - 13.0.3 - 3.1.0 + 7.1.5 + 5.0.8 + 13.0.4 + 3.1.1 1.14 1.6.5 3.4.1