@Test
public void testDuplicatePendingSlotRequest() throws Exception {

	final ResourceManagerId resourceManagerId = ResourceManagerId.generate();
	final ResourceActions resourceManagerActions = mock(ResourceActions.class);
	final AllocationID allocationId = new AllocationID();
	final ResourceProfile resourceProfile1 = new ResourceProfile(1.0, 2);
	final ResourceProfile resourceProfile2 = new ResourceProfile(2.0, 1);
	final SlotRequest slotRequest1 = new SlotRequest(new JobID(), allocationId, resourceProfile1, "foobar");
	final SlotRequest slotRequest2 = new SlotRequest(new JobID(), allocationId, resourceProfile2, "barfoo");
	try (SlotManager slotManager = createSlotManager(resourceManagerId, resourceManagerActions)) {
		assertTrue(slotManager.registerSlotRequest(slotRequest1));
		assertFalse(slotManager.registerSlotRequest(slotRequest2));
	}
	// check that we have only called the resource allocation only for the first slot request,
	// since the second request is a duplicate
	verify(resourceManagerActions, times(1)).allocateResource(any(ResourceProfile.class));
}