AbstractEnumSerializer.java

1
package pl.zankowski.iextrading4j.client.mapper;
2
3
import com.fasterxml.jackson.core.JsonGenerator;
4
import com.fasterxml.jackson.databind.JsonSerializer;
5
import com.fasterxml.jackson.databind.SerializerProvider;
6
import com.google.common.collect.BiMap;
7
8
import java.io.IOException;
9
10
public abstract class AbstractEnumSerializer<T> extends JsonSerializer<T> {
11
12
    private final BiMap<T, String> MAPPER;
13
    private final T UNKNOWN;
14
15
    AbstractEnumSerializer(final BiMap<T, String> MAPPER, final T UNKNOWN) {
16
        this.MAPPER = MAPPER;
17
        this.UNKNOWN = UNKNOWN;
18
    }
19
20
    @Override
21
    public void serialize(final T value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException {
22 2 1. serialize : negated conditional → KILLED
2. serialize : negated conditional → KILLED
        if (value == null || value == UNKNOWN) {
23 1 1. serialize : removed call to com/fasterxml/jackson/core/JsonGenerator::writeNull → KILLED
            gen.writeNull();
24
            return;
25
        }
26
27
        final String input = MAPPER.get(value);
28 1 1. serialize : negated conditional → KILLED
        if (input == null) {
29 1 1. serialize : removed call to com/fasterxml/jackson/core/JsonGenerator::writeNull → NO_COVERAGE
            gen.writeNull();
30
            return;
31
        }
32 1 1. serialize : removed call to com/fasterxml/jackson/core/JsonGenerator::writeString → KILLED
        gen.writeString(input);
33
    }
34
35
}

Mutations

22

1.1
Location : serialize
Killed by : pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest.[engine:junit-jupiter]/[class:pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest]/[method:shouldWriteStringFromValue()]
negated conditional → KILLED

2.2
Location : serialize
Killed by : pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest.[engine:junit-jupiter]/[class:pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest]/[method:shouldWriteStringFromValue()]
negated conditional → KILLED

23

1.1
Location : serialize
Killed by : pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest.[engine:junit-jupiter]/[class:pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest]/[method:shouldWriteNullIfValueIsNull()]
removed call to com/fasterxml/jackson/core/JsonGenerator::writeNull → KILLED

28

1.1
Location : serialize
Killed by : pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest.[engine:junit-jupiter]/[class:pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest]/[method:shouldWriteStringFromValue()]
negated conditional → KILLED

29

1.1
Location : serialize
Killed by : none
removed call to com/fasterxml/jackson/core/JsonGenerator::writeNull → NO_COVERAGE

32

1.1
Location : serialize
Killed by : pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest.[engine:junit-jupiter]/[class:pl.zankowski.iextrading4j.client.mapper.CryptoEventReasonSerializerTest]/[method:shouldWriteStringFromValue()]
removed call to com/fasterxml/jackson/core/JsonGenerator::writeString → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.1