1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.png.transparencyfilters;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20 import static org.junit.jupiter.api.Assertions.fail;
21
22 import org.apache.commons.imaging.ImagingConstants;
23 import org.junit.jupiter.api.Test;
24
25 public class TransparencyFilterIndexedColorTest {
26
27 @Test
28 public void testFilterWithNegativeAndNegative() {
29 final byte[] byteArray = ImagingConstants.EMPTY_BYTE_ARRAY;
30 final TransparencyFilterIndexedColor transparencyFilterIndexedColor = new TransparencyFilterIndexedColor(byteArray);
31
32 try {
33 transparencyFilterIndexedColor.filter(-416, -398);
34 fail("Expecting exception: Exception");
35 } catch (final Exception e) {
36 assertEquals("TransparencyFilterIndexedColor index: -398, bytes.length: 0", e.getMessage());
37 assertEquals(TransparencyFilterIndexedColor.class.getName(), e.getStackTrace()[0].getClassName());
38 }
39 }
40
41 }