GenesisFileServiceImpl.java

1
package org.cardanofoundation.explorer.api.service.impl;
2
3
import java.util.regex.Pattern;
4
5
import lombok.RequiredArgsConstructor;
6
7
import org.springframework.stereotype.Service;
8
9
import org.cardanofoundation.explorer.api.service.GenesisService;
10
import org.cardanofoundation.explorer.common.model.ByronGenesis;
11
import org.cardanofoundation.explorer.common.model.ConwayGenesis;
12
import org.cardanofoundation.explorer.common.model.ShelleyGenesis;
13
import org.cardanofoundation.explorer.common.utils.GenesisUtils;
14
15
@Service
16
@RequiredArgsConstructor
17
public class GenesisFileServiceImpl implements GenesisService {
18
19
  @Override
20
  public ShelleyGenesis fillContentShelley(String source) {
21 1 1. fillContentShelley : negated conditional → NO_COVERAGE
    if (isURL(source)) {
22 1 1. fillContentShelley : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentShelley → NO_COVERAGE
      return GenesisUtils.fillContentUrlToShelley(source);
23
    }
24 1 1. fillContentShelley : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentShelley → NO_COVERAGE
    return GenesisUtils.fillContentFileToShelley(source);
25
  }
26
27
  @Override
28
  public ByronGenesis fillContentByron(String source) {
29 1 1. fillContentByron : negated conditional → NO_COVERAGE
    if (isURL(source)) {
30 1 1. fillContentByron : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentByron → NO_COVERAGE
      return GenesisUtils.fillContentUrlToByron(source);
31
    }
32 1 1. fillContentByron : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentByron → NO_COVERAGE
    return GenesisUtils.fillContentFileToByron(source);
33
  }
34
35
  @Override
36
  public ConwayGenesis fillContentConway(String source) {
37 1 1. fillContentConway : negated conditional → NO_COVERAGE
    if (isURL(source)) {
38 1 1. fillContentConway : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentConway → NO_COVERAGE
      return GenesisUtils.fillContentUrlToConway(source);
39
    }
40 1 1. fillContentConway : replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentConway → NO_COVERAGE
    return GenesisUtils.fillContentFileToConway(source);
41
  }
42
43
  private boolean isURL(String input) {
44 2 1. isURL : replaced boolean return with false for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::isURL → NO_COVERAGE
2. isURL : replaced boolean return with true for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::isURL → NO_COVERAGE
    return Pattern.compile("^https?://.*").matcher(input).matches();
45
  }
46
}

Mutations

21

1.1
Location : fillContentShelley
Killed by : none
negated conditional → NO_COVERAGE

22

1.1
Location : fillContentShelley
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentShelley → NO_COVERAGE

24

1.1
Location : fillContentShelley
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentShelley → NO_COVERAGE

29

1.1
Location : fillContentByron
Killed by : none
negated conditional → NO_COVERAGE

30

1.1
Location : fillContentByron
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentByron → NO_COVERAGE

32

1.1
Location : fillContentByron
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentByron → NO_COVERAGE

37

1.1
Location : fillContentConway
Killed by : none
negated conditional → NO_COVERAGE

38

1.1
Location : fillContentConway
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentConway → NO_COVERAGE

40

1.1
Location : fillContentConway
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::fillContentConway → NO_COVERAGE

44

1.1
Location : isURL
Killed by : none
replaced boolean return with false for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::isURL → NO_COVERAGE

2.2
Location : isURL
Killed by : none
replaced boolean return with true for org/cardanofoundation/explorer/api/service/impl/GenesisFileServiceImpl::isURL → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.14.2