@Test
void removing_depot_when_there_are_other_locations_should_publish_error() {

    Location depot = new Location(1, coordinates);
    Location visit = new Location(2, coordinates);
    when(repository.locations()).thenReturn(Arrays.asList(depot, visit));
    when(repository.find(depot.id())).thenReturn(Optional.of(depot));
    locationService.removeLocation(depot.id());
    verifyNoInteractions(optimizer);
    verifyNoInteractions(distanceMatrix);
    verify(repository, never()).removeLocation(anyLong());
    verify(eventPublisher).publishEvent(any(ErrorEvent.class));
}