### Question:
ElementManagerImpl implements ElementManager { @Override public CoreElementInfo getInfo(SessionContext context, ElementContext elementContext, Id elementId) { validateItemVersionExistence(context, Space.PRIVATE, elementContext.getItemId(), elementContext.getVersionId()); if (elementContext.getRevisionId() == null) { Response<CoreElementInfo> infoResponse = getStateAdaptor(context).get(context, elementContext, elementId); ValidationUtil.validateResponse(infoResponse, logger, ErrorCode.ZU_ELEMENT_GET_INFO); return infoResponse.getValue(); } else { Namespace namespace = getValidatedNamespace(context, elementContext, elementId, ErrorCode.ZU_ELEMENT_GET_INFO); if (namespace == null) { return null; } Response<CoreElement> elementResponse = getCollaborationAdaptor(context) .getElement(context, elementContext, namespace, elementId); ValidationUtil.validateResponse(elementResponse, logger, ErrorCode.ZU_ELEMENT_GET_INFO); return coreElementToCoreElementInfo(elementResponse.getValue()); } }  @Override Collection<CoreElementInfo> list(SessionContext context, ElementContext elementContext,
                                          Id elementId); @Override CoreElementInfo getInfo(SessionContext context, ElementContext elementContext,
                                 Id elementId); @Override CoreElement get(SessionContext context, ElementContext elementContext,
                         Id elementId); @Override CoreElementConflict getConflict(SessionContext context, ElementContext elementContext,
                                         Id elementId); @Override CoreElement save(SessionContext context, ElementContext elementContext,
                          CoreElement element, String message); @Override CoreMergeResult resolveConflict(SessionContext context, ElementContext elementContext,
                                         CoreElement element, Resolution resolution); @Override SearchResult search(SessionContext context, SearchCriteria searchCriteria); @Override void saveMergeChange(SessionContext context, Space space, ElementContext elementContext,
                              Collection<CoreElement> elements);  }### Answer:
@Test public void testGetInfo() throws Exception { SessionContext context = TestUtils.createSessionContext(USER, "test"); Id itemId = new Id(); Id versionId = new Id(); Id elementId = new Id(); ElementContext elementContext = new ElementContext(itemId, versionId); CoreElementInfo retrievedElementInfo = createCoreElementInfo(elementId, new Id(), Namespace.ROOT_NAMESPACE); Response<CoreElementInfo> coreElementInfoResponse = new Response<>(retrievedElementInfo); doReturn(coreElementInfoResponse).when(stateAdaptorMock) .get(context, elementContext, elementId); CoreElementInfo elementInfo = elementManager.getInfo(context, elementContext, elementId); Assert.assertEquals(elementInfo, retrievedElementInfo); }
@Test public void testGetInfoByChangeRef() throws Exception { SessionContext context = TestUtils.createSessionContext(USER, "test"); Id itemId = new Id(); Id versionId = new Id(); Id elementId = new Id(); Id revisionId = new Id("changeRef"); ElementContext elementContext = new ElementContext(itemId, versionId, revisionId); Namespace namespace = Namespace.ROOT_NAMESPACE; doReturn(new Response<>(namespace)) .when(stateAdaptorMock).getNamespace(context, itemId, elementId); CoreElement sub1 = new CoreElement(); sub1.setId(new Id()); CoreElement sub2 = new CoreElement(); sub2.setId(new Id()); CoreElement retrievedCoreElement = createCoreElement(elementId, Action.IGNORE, null, namespace, "infoValue", Arrays.asList(new Relation(), new Relation()), sub1, sub2); Response<CoreElement> CoreElementRes = new Response<>(retrievedCoreElement); doReturn(CoreElementRes).when(collaborationAdaptorMock) .getElement(context, elementContext, namespace, elementId); CoreElementInfo elementInfo = elementManager.getInfo(context, elementContext, elementId); assertEquals(retrievedCoreElement, elementInfo); }