StreamsDelegator extends BaseDelegator implements IStreamsDelegator { @Override public List<IStreamSummary> getStreams( final List<String> streamPaths, final GetStreamsOptions opts) throws P4JavaException { String[] args = {}; if (nonNull(streamPaths)) { args = streamPaths.toArray(new String[streamPaths.size()]); } List<IStreamSummary> streamList = new ArrayList<>(); List<Map<String, Object>> resultMaps = execMapCmdList( STREAMS, processParameters(opts, null, args, server), null); if (nonNull(resultMaps)) { for (Map<String, Object> streamMap : resultMaps) { String errStr = handleFileErrorStr(streamMap); if (isNotBlank(errStr)) { Log.error(errStr); } else { streamList.add(new StreamSummary(streamMap, true)); } } } return streamList; } StreamsDelegator(IOptionsServer server); @Override List<IStreamSummary> getStreams(
            final List<String> streamPaths,
            final GetStreamsOptions opts);  }
@SuppressWarnings("unchecked") @Test public void tesGetStreamsShouldReturnNonEmptyStreamSummaries() throws Exception { String streamName2 = "streamSummary02"; String streamName3 = "streamSummary03"; Map<String, Object> resultMap2 = mock(Map.class); when(resultMap2.get(MapKeys.NAME_KEY)).thenReturn(streamName2); Map<String, Object> resultMap3 = mock(Map.class); when(resultMap3.get(MapKeys.NAME_KEY)).thenReturn(streamName3); resultMaps.add(resultMap2); resultMaps.add(resultMap3); givenHandleFileErrorStrReturnNotBlankErrorString(resultMap); List<IStreamSummary> streams = streamsDelegator.getStreams(streamPaths, opts); assertThat(streams.size(), is(2)); assertThat(streams.get(0).getName(), is(streamName2)); assertThat(streams.get(1).getName(), is(streamName3)); }