fix: Check if is under restricted
This commit is contained in:
parent
72eb53817c
commit
e96c0896b9
3 changed files with 12 additions and 2 deletions
|
|
@ -31,6 +31,7 @@
|
||||||
newman
|
newman
|
||||||
gron
|
gron
|
||||||
fx
|
fx
|
||||||
|
google-java-format
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export JAVA_HOME=${pkgs.jdk21}
|
export JAVA_HOME=${pkgs.jdk21}
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,15 @@ public class PathFinderService {
|
||||||
return new DeliveryPathResponse(0f, 0, new DronePath[0]);
|
return new DeliveryPathResponse(0f, 0, new DronePath[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var r : records) {
|
||||||
|
if (isRestricted(r.delivery())) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Delivery "
|
||||||
|
+ r.id()
|
||||||
|
+ " is located within a restricted area and cannot be fulfilled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, List<MedDispatchRecRequest>> assigned = assignDeliveries(records);
|
Map<String, List<MedDispatchRecRequest>> assigned = assignDeliveries(records);
|
||||||
|
|
||||||
List<DronePath> paths = new ArrayList<>();
|
List<DronePath> paths = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ public class ApiControllerTest {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName(
|
@DisplayName(
|
||||||
"POST /isInRegion -> 400 Bad Request: Passing a list of empty vertices to"
|
"POST /isInRegion -> 400 Bad Request: Passing a list of empty vertices to"
|
||||||
+ " isInRegion")
|
+ " isInRegion")
|
||||||
void getIsInRegion_shouldReturn400_whenPassingIllegalArguments() throws Exception {
|
void getIsInRegion_shouldReturn400_whenPassingIllegalArguments() throws Exception {
|
||||||
var position = new LngLat(1, 1);
|
var position = new LngLat(1, 1);
|
||||||
var region = new Region("illegal", List.of());
|
var region = new Region("illegal", List.of());
|
||||||
|
|
@ -281,7 +281,7 @@ public class ApiControllerTest {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName(
|
@DisplayName(
|
||||||
"POST /isInRegion -> 400 Bad Request: Passing a list of not-closing vertices to"
|
"POST /isInRegion -> 400 Bad Request: Passing a list of not-closing vertices to"
|
||||||
+ " isInRegion")
|
+ " isInRegion")
|
||||||
void getIsInRegion_shouldReturn400_whenPassingNotClosingVertices() throws Exception {
|
void getIsInRegion_shouldReturn400_whenPassingNotClosingVertices() throws Exception {
|
||||||
var position = new LngLat(1, 1);
|
var position = new LngLat(1, 1);
|
||||||
var region =
|
var region =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue