1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.jpeg.segments;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20 import static org.junit.jupiter.api.Assertions.fail;
21
22 import java.io.IOException;
23
24 import org.apache.commons.imaging.ImagingException;
25 import org.junit.jupiter.api.Test;
26
27 public class JfifSegmentTest {
28
29 @Test
30 public void testCreatesJfifSegment() throws IOException {
31 final byte[] byteArray = new byte[25];
32
33 try {
34 new JfifSegment(-2275, byteArray);
35 fail("Expecting exception: Exception");
36 } catch (final ImagingException e) {
37 assertEquals("Not a Valid JPEG File: missing JFIF string", e.getMessage());
38 assertEquals(JfifSegment.class.getName(), e.getStackTrace()[0].getClassName());
39 }
40
41 }
42
43 }