### Question:
ItemManagerImpl implements ItemManager { @Override public void update(SessionContext context, Id itemId, Info itemInfo) { validateItemExistence(context, itemId); Response response; response = getCollaborationAdaptor(context).updateItem(context, itemId, itemInfo); if (!response.isSuccessful()) { ReturnCode returnCode = new ReturnCode(ErrorCode.ZU_ITEM_UPDATE, Module.ZDB, null, response .getReturnCode()); logger.error(returnCode.toString()); throw new ZusammenException(returnCode); } Date modificationTime = new Date(); response = getStateAdaptor(context).updateItem(context, itemId, itemInfo,modificationTime); if (!response.isSuccessful()) { ReturnCode returnCode = new ReturnCode(ErrorCode.ZU_ITEM_UPDATE, 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 testUpdate() { Id itemId = new Id(); Info info = TestUtils.createInfo("item1"); doReturn(new Response<>(true)).when(stateAdaptorMock).isItemExist(context, itemId); doReturn(new Response<>(Void.TYPE)).when(stateAdaptorMock) .updateItem(eq(context), eq(itemId), eq(info), any(Date.class)); doReturn(new Response<>(Void.TYPE)).when(collaborationAdaptorMock).updateItem(context, itemId, info); itemManagerImpl.update(context, itemId, info); verify(collaborationAdaptorMock).updateItem(context, itemId, info); verify(stateAdaptorMock).updateItem(eq(context), eq(itemId), eq(info), any(Date.class)); }
@Test(expectedExceptions = ZusammenException.class) public void testUpdateNonExisting() { Id itemId = new Id(); Info info = new Info(); doReturn(new Response<>(false)).when(stateAdaptorMock).isItemExist(context, itemId); doReturn(new Response<>(Void.TYPE)).when(stateAdaptorMock) .updateItem(eq(context), eq(itemId), eq(info), any(Date.class)); doReturn(new Response<>(Void.TYPE)).when(collaborationAdaptorMock).updateItem(context, itemId, info); itemManagerImpl.update(context, itemId, info); }