### Question:
SlotSharingManager { public boolean isEmpty() { return allTaskSlots.isEmpty(); } SlotSharingManager(
			SlotSharingGroupId slotSharingGroupId,
			AllocatedSlotActions allocatedSlotActions,
			SlotOwner slotOwner); boolean isEmpty(); boolean contains(SlotRequestId slotRequestId); @Nonnull Collection<SlotSelectionStrategy.SlotInfoAndResources> listResolvedRootSlotInfo(@Nullable AbstractID groupId); @Nullable MultiTaskSlot getResolvedRootSlot(@Nonnull SlotInfo slotInfo); @Override String toString(); @VisibleForTesting Collection<MultiTaskSlot> getResolvedRootSlots();  }### Answer:
@Test public void testSlotOverAllocatedAndAllTaskSlotReleased() { SlotSharingResourceTestContext context = createResourceTestContext(new ResourceProfile(2.0, 200)); for (int i = 0; i < context.singleTaskSlotsInOrder.size(); ++i) { SlotSharingManager.SingleTaskSlot singleTaskSlot = context.singleTaskSlotsInOrder.get(i); assertThat(singleTaskSlot.getLogicalSlotFuture().isDone(), is(true)); assertThat(singleTaskSlot.getLogicalSlotFuture().isCompletedExceptionally(), is(true)); singleTaskSlot.getLogicalSlotFuture().whenComplete((LogicalSlot ignored, Throwable throwable) -> { assertThat(throwable instanceof SharedSlotOversubscribedException, is(true)); assertThat(((SharedSlotOversubscribedException) throwable).canRetry(), is(false)); }); } assertThat(context.slotSharingManager.isEmpty(), is(true)); }
@Test public void testSlotOverAllocatedAndTaskSlotsReleased() { SlotSharingResourceTestContext context = createResourceTestContext(ResourceProfile.fromResources(7.0, 700)); for (int i = 0; i < context.singleTaskSlotsInOrder.size(); ++i) { SlotSharingManager.SingleTaskSlot singleTaskSlot = context.singleTaskSlotsInOrder.get(i); assertThat(singleTaskSlot.getLogicalSlotFuture().isDone(), is(true)); assertThat(singleTaskSlot.getLogicalSlotFuture().isCompletedExceptionally(), is(true)); singleTaskSlot.getLogicalSlotFuture().whenComplete((LogicalSlot ignored, Throwable throwable) -> { assertThat(throwable, instanceOf(IllegalStateException.class)); }); } assertThat(context.slotSharingManager.isEmpty(), is(true)); }