@Test void createLocation(@Mock DistanceMatrixRow matrixRow) { String description = "new location"; when(repository.createLocation(coordinates, description)).thenReturn(location); when(distanceMatrix.addLocation(any())).thenReturn(matrixRow); assertThat(locationService.createLocation(coordinates, description)).isTrue(); verify(repository).createLocation(coordinates, description); verify(distanceMatrix).addLocation(location); verify(optimizer).addLocation(location, matrixRow); }
public synchronized boolean createLocation(Coordinates coordinates, String description) { Objects.requireNonNull(coordinates); Objects.requireNonNull(description); return submitToPlanner(repository.createLocation(coordinates, description)); }
LocationService { public synchronized boolean createLocation(Coordinates coordinates, String description) { Objects.requireNonNull(coordinates); Objects.requireNonNull(description); return submitToPlanner(repository.createLocation(coordinates, description)); } }
LocationService { public synchronized boolean createLocation(Coordinates coordinates, String description) { Objects.requireNonNull(coordinates); Objects.requireNonNull(description); return submitToPlanner(repository.createLocation(coordinates, description)); } @Autowired  LocationService(
            LocationRepository repository,
            RouteOptimizer optimizer,
            DistanceMatrix distanceMatrix,
            ApplicationEventPublisher eventPublisher); }
LocationService { public synchronized boolean createLocation(Coordinates coordinates, String description) { Objects.requireNonNull(coordinates); Objects.requireNonNull(description); return submitToPlanner(repository.createLocation(coordinates, description)); } @Autowired  LocationService(
            LocationRepository repository,
            RouteOptimizer optimizer,
            DistanceMatrix distanceMatrix,
            ApplicationEventPublisher eventPublisher); synchronized boolean createLocation(Coordinates coordinates, String description); synchronized boolean addLocation(Location location); synchronized void removeLocation(long id); synchronized void removeAll(); }
LocationService { public synchronized boolean createLocation(Coordinates coordinates, String description) { Objects.requireNonNull(coordinates); Objects.requireNonNull(description); return submitToPlanner(repository.createLocation(coordinates, description)); } @Autowired  LocationService(
            LocationRepository repository,
            RouteOptimizer optimizer,
            DistanceMatrix distanceMatrix,
            ApplicationEventPublisher eventPublisher); synchronized boolean createLocation(Coordinates coordinates, String description); synchronized boolean addLocation(Location location); synchronized void removeLocation(long id); synchronized void removeAll();  }