### Question:
PipelineStateManager { Pipeline openPipeline(PipelineID pipelineId) throws IOException { Pipeline pipeline = pipelineStateMap.getPipeline(pipelineId); if (pipeline.isClosed()) { throw new IOException("Closed pipeline can not be opened"); } if (pipeline.getPipelineState() == PipelineState.ALLOCATED) { LOG.info("Pipeline {} moved to OPEN state", pipeline); pipeline = pipelineStateMap .updatePipelineState(pipelineId, PipelineState.OPEN); } return pipeline; } PipelineStateManager(); void addPipeline(Pipeline pipeline); List<Pipeline> getPipelines(); void activatePipeline(PipelineID pipelineID); void deactivatePipeline(PipelineID pipelineID); void updatePipelineState(PipelineID id, PipelineState newState);  }### Answer:
@Test public void testOpenPipeline() throws IOException { Pipeline pipeline = createDummyPipeline(1); stateManager.addPipeline(pipeline); stateManager.openPipeline(pipeline.getId()); Assert.assertEquals(Pipeline.PipelineState.OPEN, stateManager.getPipeline(pipeline.getId()).getPipelineState()); stateManager.openPipeline(pipeline.getId()); Assert.assertEquals(Pipeline.PipelineState.OPEN, stateManager.getPipeline(pipeline.getId()).getPipelineState()); removePipeline(pipeline); }