### Question:
ItemManagerImpl implements ItemManager { @Override public void delete(SessionContext context, Id itemId) { validateItemExistence(context, itemId); Response response; response = getCollaborationAdaptor(context).deleteItem(context, itemId); if (!response.isSuccessful()) { ReturnCode returnCode = new ReturnCode(ErrorCode.ZU_ITEM_DELETE, Module.ZDB, null, response .getReturnCode()); logger.error(returnCode.toString()); throw new ZusammenException(returnCode); } response = getStateAdaptor(context).deleteItem(context, itemId); if (!response.isSuccessful()) { ReturnCode returnCode = new ReturnCode(ErrorCode.ZU_ITEM_DELETE, Module.ZDB, null, response .getReturnCode()); logger.error(returnCode.toString()); throw new ZusammenException(returnCode); } }  @Override Collection<Item> list(SessionContext context); @Override boolean isExist(SessionContext context, Id itemId); @Override Item get(SessionContext context, Id itemId); @Override Id create(SessionContext context, Info itemInfo); @Override Id create(SessionContext context, Id itemId, Info itemInfo); @Override void update(SessionContext context, Id itemId, Info itemInfo); @Override void delete(SessionContext context, Id itemId); @Override void updateModificationTime(SessionContext context, Id itemId, Date modificationTime);  }### Answer:
@Test public void testDelete() { Id itemId = new Id(); doReturn(new Response<>(true)).when(stateAdaptorMock).isItemExist(context, itemId); doReturn(new Response<>(Void.TYPE)).when(stateAdaptorMock).deleteItem(eq(context), eq(itemId)); doReturn(new Response<>(Void.TYPE)).when(collaborationAdaptorMock).deleteItem(eq(context), eq(itemId)); itemManagerImpl.delete(context, itemId); verify(collaborationAdaptorMock).deleteItem(context, itemId); verify(stateAdaptorMock).deleteItem(context, itemId); }
@Test(expectedExceptions = ZusammenException.class) public void testDeleteNonExisting() { Id itemId = new Id(); doReturn(new Response<>(false)).when(stateAdaptorMock).isItemExist(context, itemId); doReturn(new Response<>(Void.TYPE)).when(stateAdaptorMock).deleteItem(context, itemId); doReturn(new Response<>(Void.TYPE)).when(collaborationAdaptorMock).deleteItem(context, itemId); itemManagerImpl.delete(context, itemId); }