1 |
|
package org.europa.together.domain; |
2 |
|
|
3 |
|
import org.europa.together.JUnit5Preperator; |
4 |
|
import org.europa.together.application.LogbackLogger; |
5 |
|
import org.europa.together.business.Logger; |
6 |
|
import static org.junit.jupiter.api.Assertions.*; |
7 |
|
import org.junit.jupiter.api.Test; |
8 |
|
import org.junit.jupiter.api.extension.ExtendWith; |
9 |
|
|
10 |
|
@SuppressWarnings("unchecked") |
11 |
|
@ExtendWith({JUnit5Preperator.class}) |
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 3 |
Complexity Density: 0.14 |
|
12 |
|
public class ByteOrderMarkTest { |
13 |
|
|
14 |
|
private static final Logger LOGGER = new LogbackLogger(ByteOrderMarkTest.class); |
15 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
16 |
1 |
@Test... |
17 |
|
void enumName() { |
18 |
1 |
LOGGER.log("TEST CASE: enumName", LogLevel.DEBUG); |
19 |
|
|
20 |
1 |
assertEquals("NONE", |
21 |
|
ByteOrderMark.NONE.name()); |
22 |
|
|
23 |
1 |
assertEquals("UTF_8", |
24 |
|
ByteOrderMark.UTF_8.name()); |
25 |
1 |
assertEquals("UTF_16LE", |
26 |
|
ByteOrderMark.UTF_16LE.name()); |
27 |
1 |
assertEquals("UTF_16BE", |
28 |
|
ByteOrderMark.UTF_16BE.name()); |
29 |
|
|
30 |
1 |
assertEquals("UTF_32LE", |
31 |
|
ByteOrderMark.UTF_32LE.name()); |
32 |
1 |
assertEquals("UTF_32BE", |
33 |
|
ByteOrderMark.UTF_32BE.name()); |
34 |
|
} |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
36 |
1 |
@Test... |
37 |
|
void getBytes() { |
38 |
1 |
LOGGER.log("TEST CASE: getBytes", LogLevel.DEBUG); |
39 |
|
|
40 |
1 |
assertArrayEquals(new byte[]{}, |
41 |
|
ByteOrderMark.NONE.getBytes()); |
42 |
|
|
43 |
1 |
assertArrayEquals(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF}, |
44 |
|
ByteOrderMark.UTF_8.getBytes()); |
45 |
1 |
assertArrayEquals(new byte[]{(byte) 0xFF, (byte) 0xFE}, |
46 |
|
ByteOrderMark.UTF_16LE.getBytes()); |
47 |
1 |
assertArrayEquals(new byte[]{(byte) 0xFE, (byte) 0xFF}, |
48 |
|
ByteOrderMark.UTF_16BE.getBytes()); |
49 |
1 |
assertArrayEquals(new byte[]{(byte) 0xFF, (byte) 0xFE, (byte) 0x00, (byte) 0x00}, |
50 |
|
ByteOrderMark.UTF_32LE.getBytes()); |
51 |
1 |
assertArrayEquals(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0xFE, (byte) 0xFF}, |
52 |
|
ByteOrderMark.UTF_32BE.getBytes()); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
55 |
1 |
@Test... |
56 |
|
void enumValues() { |
57 |
1 |
LOGGER.log("TEST CASE: enumValues", LogLevel.DEBUG); |
58 |
|
|
59 |
1 |
assertEquals("NONE", |
60 |
|
ByteOrderMark.NONE.toString()); |
61 |
|
|
62 |
1 |
assertEquals("UTF-8", |
63 |
|
ByteOrderMark.UTF_8.toString()); |
64 |
1 |
assertEquals("UTF-16LE", |
65 |
|
ByteOrderMark.UTF_16LE.toString()); |
66 |
1 |
assertEquals("UTF-16BE", |
67 |
|
ByteOrderMark.UTF_16BE.toString()); |
68 |
|
|
69 |
1 |
assertEquals("UTF-32LE", |
70 |
|
ByteOrderMark.UTF_32LE.toString()); |
71 |
1 |
assertEquals("UTF-32BE", |
72 |
|
ByteOrderMark.UTF_32BE.toString()); |
73 |
|
} |
74 |
|
} |