TokenPageCacheServiceImpl.java

1
package org.cardanofoundation.explorer.api.service.impl.cache;
2
3
import java.time.LocalDate;
4
import java.time.LocalDateTime;
5
import java.time.format.DateTimeFormatter;
6
7
import lombok.RequiredArgsConstructor;
8
import lombok.extern.slf4j.Slf4j;
9
10
import org.springframework.beans.factory.annotation.Value;
11
import org.springframework.data.domain.Pageable;
12
import org.springframework.data.redis.core.RedisTemplate;
13
import org.springframework.stereotype.Service;
14
15
import com.google.gson.*;
16
17
import org.cardanofoundation.explorer.api.service.cache.TokenPageCacheService;
18
19
@Service
20
@RequiredArgsConstructor
21
@Slf4j
22
public class TokenPageCacheServiceImpl implements TokenPageCacheService {
23
  private final RedisTemplate<String, Object> redisTemplate;
24
25
  @Value("${application.network}")
26
  private String network;
27
28
  private static final Gson GSON =
29
      new GsonBuilder()
30
          .registerTypeAdapter(
31
              LocalDate.class,
32
              (JsonSerializer<LocalDate>)
33
                  (value, type, context) ->
34 1 1. lambda$static$0 : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$0 → NO_COVERAGE
                      new JsonPrimitive(value.format(DateTimeFormatter.ISO_LOCAL_DATE)))
35
          .registerTypeAdapter(
36
              LocalDateTime.class,
37
              (JsonSerializer<LocalDateTime>)
38
                  (value, type, context) ->
39 1 1. lambda$static$1 : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$1 → NO_COVERAGE
                      new JsonPrimitive(value.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)))
40
          .registerTypeAdapter(
41
              LocalDate.class,
42
              (JsonDeserializer<LocalDate>)
43
                  (jsonElement, type, context) ->
44 1 1. lambda$static$2 : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$2 → NO_COVERAGE
                      LocalDate.parse(
45
                          jsonElement.getAsJsonPrimitive().getAsString(),
46
                          DateTimeFormatter.ISO_LOCAL_DATE))
47
          .registerTypeAdapter(
48
              LocalDateTime.class,
49
              (JsonDeserializer<LocalDateTime>)
50
                  (jsonElement, type, context) ->
51 1 1. lambda$static$3 : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$3 → NO_COVERAGE
                      LocalDateTime.parse(
52
                          jsonElement.getAsJsonPrimitive().getAsString(),
53
                          DateTimeFormatter.ISO_LOCAL_DATE_TIME))
54
          .create();
55
56
  private String toStr(Pageable pageable) {
57 1 1. toStr : replaced return value with "" for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::toStr → NO_COVERAGE
    return pageable.toString().replace(" ", "").replace(":", "_");
58
  }
59
}

Mutations

34

1.1
Location : lambda$static$0
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$0 → NO_COVERAGE

39

1.1
Location : lambda$static$1
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$1 → NO_COVERAGE

44

1.1
Location : lambda$static$2
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$2 → NO_COVERAGE

51

1.1
Location : lambda$static$3
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::lambda$static$3 → NO_COVERAGE

57

1.1
Location : toStr
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/service/impl/cache/TokenPageCacheServiceImpl::toStr → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.14.2