### Question:
PowerPointMetadataReader { public static List<SlideMetadata> instance( InputStream stream ) throws IOException { SlideShow slideshow = new SlideShow(stream); Slide[] slides = slideshow.getSlides(); List<SlideMetadata> slidesMetadata = new ArrayList<SlideMetadata>(); for (Slide slide : slides) { SlideMetadata slideMetadata = new SlideMetadata(); slideMetadata.setTitle(slide.getTitle()); for (TextRun textRun : slide.getNotesSheet().getTextRuns()) { if (slideMetadata.getNotes() == null) { slideMetadata.setNotes(""); } slideMetadata.setNotes(slideMetadata.getNotes() + textRun.getText()); } for (TextRun textRun : slide.getTextRuns()) { if (!textRun.getText().equals(slideMetadata.getTitle()) && textRun.getText() != null) { if (slideMetadata.getText() == null) { slideMetadata.setText(""); } slideMetadata.setText(slideMetadata.getText() + textRun.getText()); } } Dimension pgsize = slideshow.getPageSize(); BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); slide.draw(graphics); ByteArrayOutputStream out = new ByteArrayOutputStream(); javax.imageio.ImageIO.write(img, "png", out); slideMetadata.setThumbnail(out.toByteArray()); slidesMetadata.add(slideMetadata); } return slidesMetadata; }  static List<SlideMetadata> instance( InputStream stream );  }### Answer:
@Test public void shouldBeAbleToCreateMetadataForPowerPoint() throws Exception { pptReader = PowerPointMetadataReader.instance(this.getTestDocument("powerpoint.ppt")); SlideMetadata slide = pptReader.get(0); assertThat(slide.getTitle(), is("Test Slide")); assertThat(slide.getText(), is("This is some text")); assertThat(slide.getNotes(), is("My notes")); try { FileOutputStream out = new FileOutputStream("slide.png"); out.write(slide.getThumbnail()); out.close(); File f = new File("slide.png"); assertThat(f.exists(), is(true)); f.delete(); } catch (Exception e) { e.printStackTrace(); } }