1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.tiff.fieldtypes;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20 import static org.junit.jupiter.api.Assertions.fail;
21
22 import java.nio.ByteOrder;
23
24 import org.junit.jupiter.api.Test;
25
26 public class FieldTypeShortTest {
27
28 @Test
29 public void testCreatesFieldTypeShortAndCallsWriteData() {
30 final FieldTypeShort fieldTypeShort = new FieldTypeShort(1234, "");
31 final ByteOrder byteOrder = ByteOrder.LITTLE_ENDIAN;
32
33 try {
34 fieldTypeShort.writeData("", byteOrder);
35 fail("Expecting exception: Exception");
36 } catch (final Exception e) {
37 assertEquals("Invalid data: (java.lang.String)", e.getMessage());
38 assertEquals(FieldTypeShort.class.getName(), e.getStackTrace()[0].getClassName());
39 }
40 }
41
42 }