PrintDelegator extends BaseDelegator implements IPrintDelegator { @Override public InputStream getFileContents( final List<IFileSpec> fileSpecs, final boolean allRevs, final boolean noHeaderLine) throws ConnectionException, RequestException, AccessException { try { return getFileContents(fileSpecs, new GetFileContentsOptions(allRevs, noHeaderLine)); } catch (final ConnectionException | AccessException | RequestException exc) { throw exc; } catch (P4JavaException exc) { throw new RequestException(exc.getMessage(), exc); } } PrintDelegator(IOptionsServer server); @Override InputStream getFileContents(
            final List<IFileSpec> fileSpecs,
            final boolean allRevs,
            final boolean noHeaderLine); @Override InputStream getFileContents(
            final List<IFileSpec> fileSpecs,
            final GetFileContentsOptions opts);  }
@Test public void testGetFileContentsShouldReturnNonNullInputStream() throws Exception { when(server.execStreamCmd(eq(PRINT.toString()), eq(PRINT_CMD_ARGUMENTS))) .thenReturn(mockInputStream); InputStream fileContents = printDelegator.getFileContents( mockFileSpecs, ALL_REVS, NO_HEADER_LINE); assertThat(fileContents, is(mockInputStream)); }
@Test public void testGetFileContentsByFileSpecsAndGetFileContentsOptions() throws Exception { when(server.execStreamCmd(eq(PRINT.toString()), eq(new String[]{TEST_FILE_DEPOT_PATH}))) .thenReturn(mockInputStream); InputStream fileContents = printDelegator.getFileContents(mockFileSpecs, null); assertThat(fileContents, is(mockInputStream)); }