JacksonCodecs.java

1
package com.yubico.internal.util;
2
3
import com.fasterxml.jackson.annotation.JsonInclude.Include;
4
import com.fasterxml.jackson.core.Base64Variants;
5
import com.fasterxml.jackson.databind.DeserializationFeature;
6
import com.fasterxml.jackson.databind.ObjectMapper;
7
import com.fasterxml.jackson.databind.json.JsonMapper;
8
import com.fasterxml.jackson.databind.node.ObjectNode;
9
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
10
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
11
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
12
import com.upokecenter.cbor.CBORObject;
13
import java.io.IOException;
14
15
public class JacksonCodecs {
16
17
  public static ObjectMapper cbor() {
18 1 1. cbor : replaced return value with null for com/yubico/internal/util/JacksonCodecs::cbor → NO_COVERAGE
    return new ObjectMapper(new CBORFactory()).setBase64Variant(Base64Variants.MODIFIED_FOR_URL);
19
  }
20
21
  public static ObjectMapper json() {
22 1 1. json : replaced return value with null for com/yubico/internal/util/JacksonCodecs::json → NO_COVERAGE
    return JsonMapper.builder()
23
        .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
24
        .serializationInclusion(Include.NON_ABSENT)
25
        .defaultBase64Variant(Base64Variants.MODIFIED_FOR_URL)
26
        .addModule(new Jdk8Module())
27
        .addModule(new JavaTimeModule())
28
        .build();
29
  }
30
31
  public static CBORObject deepCopy(CBORObject a) {
32 1 1. deepCopy : replaced return value with null for com/yubico/internal/util/JacksonCodecs::deepCopy → NO_COVERAGE
    return CBORObject.DecodeFromBytes(a.EncodeToBytes());
33
  }
34
35
  public static ObjectNode deepCopy(ObjectNode a) {
36
    try {
37 1 1. deepCopy : replaced return value with null for com/yubico/internal/util/JacksonCodecs::deepCopy → NO_COVERAGE
      return (ObjectNode) json().readTree(json().writeValueAsString(a));
38
    } catch (IOException e) {
39
      throw new RuntimeException(e);
40
    }
41
  }
42
}

Mutations

18

1.1
Location : cbor
Killed by : none
replaced return value with null for com/yubico/internal/util/JacksonCodecs::cbor → NO_COVERAGE

22

1.1
Location : json
Killed by : none
replaced return value with null for com/yubico/internal/util/JacksonCodecs::json → NO_COVERAGE

32

1.1
Location : deepCopy
Killed by : none
replaced return value with null for com/yubico/internal/util/JacksonCodecs::deepCopy → NO_COVERAGE

37

1.1
Location : deepCopy
Killed by : none
replaced return value with null for com/yubico/internal/util/JacksonCodecs::deepCopy → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.15.0