public void testReadIndexNegative() { ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); BufferedImage image = null; try { image = reader.read(-1); fail("Read image with illegal index"); } catch (IndexOutOfBoundsException ignore) { } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadIndexOutOfBounds() { ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); BufferedImage image = null; try { image = reader.read(Integer.MAX_VALUE); // TODO: This might actually not throw exception... fail("Read image with index out of bounds"); } catch (IndexOutOfBoundsException ignore) { } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadIndexOutOfBoundsWithParam() { ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); BufferedImage image = null; try { image = reader.read(99, reader.getDefaultReadParam()); fail("Read image with index out of bounds"); } catch (IndexOutOfBoundsException ignore) { } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadAsRenderedImageIndexNegative() { ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); RenderedImage image = null; try { image = reader.readAsRenderedImage(-1, reader.getDefaultReadParam()); fail("Read image with illegal index"); } catch (IndexOutOfBoundsException expected) { // Ignore } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadNoInput() { ImageReader reader = createReader(); // Do not set input BufferedImage image = null; try { image = reader.read(0); fail("Read image with no input"); } catch (IllegalStateException ignore) { } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadIndexNegativeWithParam() { ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); BufferedImage image = null; try { image = reader.read(-1, reader.getDefaultReadParam()); fail("Read image with illegal index"); } catch (IndexOutOfBoundsException ignore) { } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadNoInputWithParam() { ImageReader reader = createReader(); // Do not set input BufferedImage image = null; try { image = reader.read(0, reader.getDefaultReadParam()); fail("Read image with no input"); } catch (IllegalStateException ignore) { } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadAsRenderedImageNoInput() { ImageReader reader = createReader(); // Do not set input BufferedImage image = null; try { image = reader.read(0, reader.getDefaultReadParam()); fail("Read image with no input"); } catch (IllegalStateException expected) { // Ignore } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }
public void testReadAsRenderedImageIndexOutOfBounds() throws IIOException { ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); RenderedImage image = null; try { image = reader.readAsRenderedImage(reader.getNumImages(true), reader.getDefaultReadParam()); fail("Read image with index out of bounds"); } catch (IndexOutOfBoundsException expected) { // Ignore } catch (IIOException e) { // Allow this to bubble up, due to a bug in the Sun JPEGImageReader throw e; } catch (IOException e) { fail("Image could not be read: " + e); } assertNull(image); }