@Test
public void testAllPreferredLocationCalculation() throws ExecutionException, InterruptedException {

	final TaskManagerLocation taskManagerLocation1 = new LocalTaskManagerLocation();
	final TaskManagerLocation taskManagerLocation2 = new LocalTaskManagerLocation();
	final TaskManagerLocation taskManagerLocation3 = new LocalTaskManagerLocation();
	final CompletableFuture<TaskManagerLocation> locationFuture1 = CompletableFuture.completedFuture(taskManagerLocation1);
	final CompletableFuture<TaskManagerLocation> locationFuture2 = new CompletableFuture<>();
	final CompletableFuture<TaskManagerLocation> locationFuture3 = new CompletableFuture<>();
	final Execution execution = SchedulerTestUtils.getTestVertex(Arrays.asList(locationFuture1, locationFuture2, locationFuture3));
	CompletableFuture<Collection<TaskManagerLocation>> preferredLocationsFuture = execution.calculatePreferredLocations(LocationPreferenceConstraint.ALL);
	assertFalse(preferredLocationsFuture.isDone());
	locationFuture3.complete(taskManagerLocation3);
	assertFalse(preferredLocationsFuture.isDone());
	locationFuture2.complete(taskManagerLocation2);
	assertTrue(preferredLocationsFuture.isDone());
	final Collection<TaskManagerLocation> preferredLocations = preferredLocationsFuture.get();
	assertThat(preferredLocations, containsInAnyOrder(taskManagerLocation1, taskManagerLocation2, taskManagerLocation3));
}