@@ -130,29 +130,16 @@ void testCreateFromByteArray() throws IOException, URISyntaxException
130130 }
131131
132132 /**
133- * Test of createFromByteArray method with DefaultFactory parameter, of class PDImageXObject.
133+ * Test of createFromByteArray method with CustomFactory parameter, of class PDImageXObject.
134134 * @throws java.io.IOException
135135 * @throws java.net.URISyntaxException
136136 */
137137 @ Test
138- void testCreateFromByteArrayWithDefaultFactory () throws IOException , URISyntaxException
138+ void testCreateFromByteArrayWithCustomFactory () throws IOException , URISyntaxException
139139 {
140- testCompareCreatedFromByteArrayWithCreatedByDefaultFactory ("gif.gif" );
141- testCompareCreatedFromByteArrayWithCreatedByDefaultFactory ("gif-1bit-transparent.gif" );
142- testCompareCreatedFromByteArrayWithCreatedByDefaultFactory ("lzw.tif" );
143- }
144-
145- /**
146- * Test of createFromByteArray method with null DefaultFactory parameter, of class PDImageXObject.
147- * @throws java.io.IOException
148- * @throws java.net.URISyntaxException
149- */
150- @ Test
151- void testCreateFromByteArrayWithNullDefaultFactory () throws IOException , URISyntaxException
152- {
153- testCompareCreatedFromByteArrayWithCreatedByNullDefaultFactory ("gif.gif" );
154- testCompareCreatedFromByteArrayWithCreatedByNullDefaultFactory ("gif-1bit-transparent.gif" );
155- testCompareCreatedFromByteArrayWithCreatedByNullDefaultFactory ("lzw.tif" );
140+ testCompareCreatedFromByteArrayWithCreatedByCustomFactory ("gif.gif" );
141+ testCompareCreatedFromByteArrayWithCreatedByCustomFactory ("gif-1bit-transparent.gif" );
142+ testCompareCreatedFromByteArrayWithCreatedByCustomFactory ("lzw.tif" );
156143 }
157144
158145 private void testCompareCreatedFileByExtensionWithCreatedByLosslessFactory (String filename )
@@ -348,7 +335,7 @@ private void testCompareCreatedFromByteArrayWithCreatedByJPEGFactory(String file
348335 }
349336 }
350337
351- private void testCompareCreatedFromByteArrayWithCreatedByDefaultFactory (String filename )
338+ private void testCompareCreatedFromByteArrayWithCreatedByCustomFactory (String filename )
352339 throws IOException , URISyntaxException
353340 {
354341 try (PDDocument doc = new PDDocument ())
@@ -357,9 +344,9 @@ private void testCompareCreatedFromByteArrayWithCreatedByDefaultFactory(String f
357344 InputStream in = new FileInputStream (file );
358345 byte [] byteArray = in .readAllBytes ();
359346
360- DefaultFactory defaultFactory = this ::alphaFlattenedJPEGFactory ;
347+ CustomFactory customFactory = this ::alphaFlattenedJPEGFactory ;
361348
362- PDImageXObject image = PDImageXObject .createFromByteArray (doc , byteArray , filename , defaultFactory );
349+ PDImageXObject image = PDImageXObject .createFromByteArray (doc , byteArray , filename , customFactory );
363350
364351 PDImageXObject expectedImage = alphaFlattenedJPEGFactory (doc , byteArray );
365352
@@ -368,28 +355,6 @@ private void testCompareCreatedFromByteArrayWithCreatedByDefaultFactory(String f
368355 }
369356 }
370357
371- private void testCompareCreatedFromByteArrayWithCreatedByNullDefaultFactory (String filename )
372- throws IOException , URISyntaxException
373- {
374- try (PDDocument doc = new PDDocument ())
375- {
376- File file = new File (PDImageXObjectTest .class .getResource (filename ).toURI ());
377- InputStream in = new FileInputStream (file );
378- byte [] byteArray = in .readAllBytes ();
379-
380- DefaultFactory defaultFactory = null ;
381-
382- PDImageXObject image = PDImageXObject .createFromByteArray (doc , byteArray , filename , defaultFactory );
383-
384- ByteArrayInputStream bais = new ByteArrayInputStream (byteArray );
385- BufferedImage bim = ImageIO .read (bais );
386- PDImageXObject expectedImage = LosslessFactory .createFromImage (doc , bim );
387-
388- assertEquals (expectedImage .getSuffix (), image .getSuffix ());
389- checkIdentARGB (image .getImage (), expectedImage .getImage ());
390- }
391- }
392-
393358 private void checkIdentARGB (BufferedImage expectedImage , BufferedImage actualImage )
394359 {
395360 String errMsg = "" ;
0 commit comments