1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.pcx;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20 import static org.junit.jupiter.api.Assertions.fail;
21
22 import java.io.ByteArrayInputStream;
23
24 import org.junit.jupiter.api.Test;
25
26 public class RleReaderTest {
27
28 @Test
29 public void testReadWithNonNull() {
30 final RleReader rleReader = new RleReader(false);
31 final byte[] byteArray = new byte[1];
32 final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray, (byte) -64, (byte) -64);
33
34 try {
35 rleReader.read(byteArrayInputStream, byteArray);
36 fail("Expecting exception: Exception");
37 } catch (final Exception e) {
38 assertEquals("Premature end of file reading image data", e.getMessage());
39 assertEquals(RleReader.class.getName(), e.getStackTrace()[0].getClassName());
40 }
41 }
42
43 }