PdfStreamSource extends AbstractPdfSource<InputStream> { public static PdfStreamSource newInstanceWithPassword(InputStream stream, String name, String password) { if (stream == null) { throw new IllegalArgumentException("A not null stream instance and a not blank name are expected."); } return new PdfStreamSource(stream, name, password); } private  PdfStreamSource(InputStream stream, String name, String password); @Override InputStream getSource(); @Override T open(PdfSourceOpener<T> opener); @Override SeekableSource initializeSeekableSource(); static PdfStreamSource newInstanceNoPassword(InputStream stream, String name); static PdfStreamSource newInstanceWithPassword(InputStream stream, String name, String password);  }
@Test(expected = IllegalArgumentException.class) public void testNullStream() { PdfStreamSource.newInstanceWithPassword(null, "fdsfs", null); }
@Test(expected = IllegalArgumentException.class) public void testNullName() { InputStream stream = mock(InputStream.class); PdfStreamSource.newInstanceWithPassword(stream, null, null); }
@Test public void testValidStream() { InputStream stream = mock(InputStream.class); PdfStreamSource instance = PdfStreamSource.newInstanceWithPassword(stream, "dsadsada", "dsdasdsa"); assertNotNull(instance); }