1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.psd.dataparsers;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20 import static org.junit.jupiter.api.Assertions.assertTrue;
21 import static org.junit.jupiter.api.Assertions.fail;
22
23 import org.junit.jupiter.api.Test;
24
25 public class DataParserIndexedTest {
26
27 @Test
28 public void testFailsToCreateDataParserIndexedThrowsArrayIndexOutOfBoundsException() {
29 final byte[] byteArray = new byte[24];
30 try {
31 new DataParserIndexed(byteArray);
32 fail("Expecting exception: ArrayIndexOutOfBoundsException");
33 } catch (final ArrayIndexOutOfBoundsException e) {
34 assertTrue(e.getMessage().contains("256"));
35 assertEquals(DataParserIndexed.class.getName(), e.getStackTrace()[0].getClassName());
36 }
37 }
38
39 }