### Question:
PipelineRunLoader extends AbstractCloudPipelineEntityLoader<PipelineRunWithLog> { @Override protected String getOwner(final PipelineRunWithLog entity) { return entity.getPipelineRun().getOwner(); } PipelineRunLoader(final CloudPipelineAPIClient apiClient);   }### Answer:
@Test void shouldLoadPipelineRunTest() throws EntityNotFoundException { RunInstance instance = new RunInstance(); instance.setNodeType("type"); instance.setCloudRegionId(1L); instance.setSpot(true); instance.setNodeDisk(NODE_DISK); instance.setNodeId("id"); instance.setNodeImage(TEST_PATH); instance.setNodeName(TEST_NAME); RunStatus runStatus = new RunStatus(); runStatus.setRunId(1L); runStatus.setStatus(TaskStatus.SUCCESS); PipelineRunParameter parameter = new PipelineRunParameter(); parameter.setName(TEST_NAME); parameter.setValue(TEST_VALUE); PipelineRun expectedPipelineRun = new PipelineRun(); expectedPipelineRun.setId(1L); expectedPipelineRun.setName(TEST_NAME); expectedPipelineRun.setPipelineName(TEST_NAME); expectedPipelineRun.setPipelineId(1L); expectedPipelineRun.setInstance(instance); expectedPipelineRun.setStatus(TaskStatus.SUCCESS); expectedPipelineRun.setVersion(TEST_VERSION); expectedPipelineRun.setRunStatuses(Collections.singletonList(runStatus)); expectedPipelineRun.setPricePerHour(PRICE); expectedPipelineRun.setOwner(TEST_NAME); expectedPipelineRun.setPipelineRunParameters(Collections.singletonList(parameter)); RunLog runLog = new RunLog(); runLog.setLogText(TEST_DESCRIPTION); runLog.setStatus(TaskStatus.SUCCESS); runLog.setTask(new PipelineTask(TEST_NAME)); List<RunLog> runLogs = Collections.singletonList(runLog); PipelineRunWithLog expectedPipelineRunWithLog = new PipelineRunWithLog(); expectedPipelineRunWithLog.setPipelineRun(expectedPipelineRun); expectedPipelineRunWithLog.setRunOwner(USER); expectedPipelineRunWithLog.setRunLogs(runLogs); PipelineRunLoader pipelineRunLoader = new PipelineRunLoader(apiClient); when(apiClient.loadPipelineRunWithLogs(anyLong())).thenReturn(expectedPipelineRunWithLog); when(apiClient.loadPipelineRun(anyLong())).thenReturn(expectedPipelineRun); Optional<EntityContainer<PipelineRunWithLog>> container = pipelineRunLoader.loadEntity(1L); EntityContainer<PipelineRunWithLog> pipelineRunEntityContainer = container.orElseThrow(AssertionError::new); PipelineRunWithLog actualPipelineRunWithLog = pipelineRunEntityContainer.getEntity(); assertNotNull(actualPipelineRunWithLog); PipelineRun actualPipelineRun = actualPipelineRunWithLog.getPipelineRun(); assertNotNull(actualPipelineRun); List<RunLog> actualRunLogs = actualPipelineRunWithLog.getRunLogs(); assertNotNull(actualRunLogs); verifyPipelineRun(expectedPipelineRun, actualPipelineRun); verifyRunInstance(expectedPipelineRun.getInstance(), actualPipelineRun.getInstance()); verifyRunStatuses(expectedPipelineRun.getRunStatuses(), actualPipelineRun.getRunStatuses()); verifyRunParameters(expectedPipelineRun.getPipelineRunParameters(), actualPipelineRun.getPipelineRunParameters()); verifyRunLogs(runLogs, actualRunLogs); verifyPipelineUser(pipelineRunEntityContainer.getOwner()); verifyPermissions(PERMISSIONS_CONTAINER_WITH_OWNER, pipelineRunEntityContainer.getPermissions()); }