ByteOrderMark.java

1
package org.europa.together.domain;
2
3
import java.util.Arrays;
4
5
/**
6
 * Existing Byte Order Mark (BOM) types.
7
 */
8
public enum ByteOrderMark {
9
10
    /**
11
     * None.
12
     */
13
    NONE("NONE", new byte[]{}),
14
    /**
15
     * UTF-8.
16
     */
17
    UTF_8("UTF-8", new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF}),
18
    /**
19
     * UTF-16 Low Endian.
20
     */
21
    UTF_16LE("UTF-16LE", new byte[]{(byte) 0xFF, (byte) 0xFE}),
22
    /**
23
     * UTF-16 Big Endian.
24
     */
25
    UTF_16BE("UTF-16BE", new byte[]{(byte) 0xFE, (byte) 0xFF}),
26
    /**
27
     * UTF-32 Low Endian.
28
     */
29
    UTF_32LE("UTF-32LE", new byte[]{(byte) 0xFF, (byte) 0xFE, (byte) 0x00, (byte) 0x00}),
30
    /**
31
     * UTF-32 Big Endian.
32
     */
33
    UTF_32BE("UTF-32BE", new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0xFE, (byte) 0xFF});
34
35
    private final String type;
36
    private final byte[] value;
37
38
    //CONSTRUCTOR
39
    ByteOrderMark(final String type, final byte[] value) {
40
        this.type = type;
41
        this.value = value;
42
    }
43
44
    /**
45
     * Get the Byte vale for a Byte Order.
46
     *
47
     * @return value as Byte
48
     */
49
    public byte[] getBytes() {
50
        byte[] val = Arrays.copyOf(this.value, this.value.length);
51 1 1. getBytes : replaced return value with null for org/europa/together/domain/ByteOrderMark::getBytes → KILLED
        return val;
52
    }
53
54
    @Override
55
    public String toString() {
56 1 1. toString : replaced return value with "" for org/europa/together/domain/ByteOrderMark::toString → KILLED
        return this.type;
57
    }
58
}

Mutations

51

1.1
Location : getBytes
Killed by : org.europa.together.domain.ByteOrderMarkTest.[engine:junit-jupiter]/[class:org.europa.together.domain.ByteOrderMarkTest]/[method:getBytes()]
replaced return value with null for org/europa/together/domain/ByteOrderMark::getBytes → KILLED

56

1.1
Location : toString
Killed by : org.europa.together.utils.FileUtilsTest.[engine:junit-jupiter]/[class:org.europa.together.utils.FileUtilsTest]/[method:readFileStream()]
replaced return value with "" for org/europa/together/domain/ByteOrderMark::toString → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.0