### Question:
InMemoryPipelineRegistry implements PipelineRegistry { @Override public List<Pipeline> getPipelines(final int page, final int pageSize, final String sort, final boolean sortOrder) { final List<Pipeline> values = pipelineByName.values() .stream() .map(PipelineRegistryEntry::getPipeline).collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); } InMemoryPipelineRegistry(); @Override void registerPipeline(final Pipeline pipeline); @Override void registerPipeline(final Pipeline pipeline,
                                 final ProviderType providerType); @Override Pipeline getPipelineByName(final String pipelineId); @Override List<Pipeline> getPipelines(final int page,
                                       final int pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override List<Pipeline> getPipelines(final String providerType,
                                       final String version,
                                       final int page,
                                       final int pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override ProviderType getProviderType(final String pipelineId);  }### Answer:
@Test public void testGetPipelines() { List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(result.isEmpty()); List<Pipeline> pipelines = mockPipelineList("", ELEMENTS_COUNT); pipelines.forEach(pipeline -> pipelineRegistry.registerPipeline(pipeline)); result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); for (Pipeline pipeline : pipelines) { assertTrue(result.contains(pipeline)); } }
@Test public void getPipelinesForProvider() { ProviderType providerType1 = mockProviderTypeSPI("providerType1"); ProviderType providerType2 = mockProviderTypeSPI("providerType2"); List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(result.isEmpty()); List<Pipeline> pipelines = mockPipelineList("providerType", ELEMENTS_COUNT); registerPipelinesForProviderType(pipelines, providerType); registerPipelinesForProviderType(mockPipelineList("providerType1", ELEMENTS_COUNT), providerType1); registerPipelinesForProviderType(mockPipelineList("providerType2", ELEMENTS_COUNT), providerType2); result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertEquals(3 * ELEMENTS_COUNT, result.size()); result = pipelineRegistry.getPipelines(providerType.getProviderTypeName(), providerType.getVersion(), 0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertEquals(pipelines.size(), result.size()); for (Pipeline pipeline : result) { assertTrue(result.contains(pipeline)); } }