@Test public void getImageInRenderPhase() throws IOException { mediaBean.setRequestParameter("email"); mediaBean.setRenderPhase(true); StreamedContent streamedContent = mediaBean.getImage(); Assert.assertNotNull(streamedContent); Assert.assertNull(streamedContent.getStream()); }
@Test public void getImage() throws IOException { mediaBean.setRequestParameter("email"); StreamedContent streamedContent = mediaBean.getImage(); Assert.assertNotNull(streamedContent); Assert.assertNotNull(streamedContent.getStream()); Assert.assertEquals("png", streamedContent.getContentType()); Assert.assertEquals("email", streamedContent.getName()); }
@Test public void paintWithNullData() throws IOException { mediaBean.setRequestParameter(null); StreamedContent streamedContent = mediaBean.getImage(); Assert.assertNull(streamedContent); }