@Test
public void testSlotRequestWithResourceAllocationFailure() throws Exception {

	final ResourceManagerId resourceManagerId = ResourceManagerId.generate();
	final ResourceProfile resourceProfile = new ResourceProfile(42.0, 1337);
	final SlotRequest slotRequest = new SlotRequest(
		new JobID(),
		new AllocationID(),
		resourceProfile,
		"localhost");
	ResourceActions resourceManagerActions = mock(ResourceActions.class);
	doThrow(new ResourceManagerException("Test exception")).when(resourceManagerActions).allocateResource(any(ResourceProfile.class));
	try (SlotManager slotManager = createSlotManager(resourceManagerId, resourceManagerActions)) {
		slotManager.registerSlotRequest(slotRequest);
		fail("The slot request should have failed with a ResourceManagerException.");
	} catch (ResourceManagerException e) {
		// expected exception
	}
}