### Question:
PipelineLoader extends AbstractCloudPipelineEntityLoader<PipelineDoc> { @Override protected String getOwner(PipelineDoc entity) { return entity.getPipeline().getOwner(); } PipelineLoader(final CloudPipelineAPIClient apiClient);   }### Answer:
@Test void shouldLoadPipeline() throws EntityNotFoundException { Pipeline expectedPipeline = new Pipeline(1L); expectedPipeline.setName(TEST_NAME); expectedPipeline.setCreatedDate(DateUtils.now()); expectedPipeline.setParentFolderId(2L); expectedPipeline.setDescription(TEST_DESCRIPTION); expectedPipeline.setRepository(TEST_REPO); expectedPipeline.setTemplateId(TEST_TEMPLATE); expectedPipeline.setOwner(TEST_NAME); Revision expectedRevision = new Revision(); expectedRevision.setName(TEST_NAME); PipelineLoader pipelineLoader = new PipelineLoader(apiClient); when(apiClient.loadPipeline(anyString())).thenReturn(expectedPipeline); when(apiClient.loadPipelineVersions(anyLong())).thenReturn(Collections.singletonList(expectedRevision)); Optional<EntityContainer<PipelineDoc>> container = pipelineLoader.loadEntity(1L); EntityContainer<PipelineDoc> pipelineDocEntityContainer = container.orElseThrow(AssertionError::new); PipelineDoc actualPipelineDoc = pipelineDocEntityContainer.getEntity(); assertNotNull(actualPipelineDoc); Pipeline actualPipeline = actualPipelineDoc.getPipeline(); assertNotNull(actualPipeline); List<Revision> revisions = actualPipelineDoc.getRevisions(); assertNotNull(revisions); assertEquals(expectedPipeline.getId(), actualPipeline.getId()); assertEquals(expectedPipeline.getName(), actualPipeline.getName()); assertEquals(expectedPipeline.getCreatedDate(), actualPipeline.getCreatedDate()); assertEquals(expectedPipeline.getParentFolderId(), actualPipeline.getParentFolderId()); assertEquals(expectedPipeline.getDescription(), actualPipeline.getDescription()); assertEquals(expectedPipeline.getRepository(), actualPipeline.getRepository()); assertEquals(expectedPipeline.getTemplateId(), actualPipeline.getTemplateId()); verifyPipelineUser(pipelineDocEntityContainer.getOwner()); verifyPermissions(PERMISSIONS_CONTAINER_WITH_OWNER, pipelineDocEntityContainer.getPermissions()); verifyMetadata(EXPECTED_METADATA, new ArrayList<>(pipelineDocEntityContainer.getMetadata().values())); }