### Question:
ElementFactory { public Vertex getVertex(UUID id) { if (id == null) return null; try { return vertexCache.get(id); } catch (Exception ignored) { LOGGER.warning(ignored, "Failed to get vertex with id = %s.", id); return null; } } private  ElementFactory(ActGraph owner); Edge getEdge(UUID id); Edge createEdge(FactRecord factRecord, UUID sourceId); Vertex getVertex(UUID id); static Builder builder();  }### Answer:
@Test public void testGetVertexWithNullId() { assertNull(elementFactory.getVertex(null)); }
@Test public void testGetVertexNotExists() { assertNull(elementFactory.getVertex(UUID.randomUUID())); }
@Test public void testGetVertexNotCached() { ObjectTypeStruct objectTypeMock = mockObjectType(); ObjectRecord objectSource = mockObject(objectTypeMock); UUID objectID = objectSource.getId(); assertEquals(objectID, elementFactory.getVertex(objectID).id()); }
@Test public void testGetVertexCached() { ObjectTypeStruct objectTypeMock = mockObjectType(); ObjectRecord objectSource = mockObject(objectTypeMock); UUID objectID = objectSource.getId(); Vertex first = elementFactory.getVertex(objectID); Vertex second = elementFactory.getVertex(objectID); assertSame(first, second); }