TxMapper.java

1
package org.cardanofoundation.explorer.api.mapper;
2
3
import java.sql.Timestamp;
4
import java.time.LocalDateTime;
5
6
import org.mapstruct.Mapper;
7
import org.mapstruct.Mapping;
8
9
import org.cardanofoundation.explorer.api.model.response.TxFilterResponse;
10
import org.cardanofoundation.explorer.api.model.response.tx.TxResponse;
11
import org.cardanofoundation.explorer.common.entity.ledgersync.Tx;
12
13
@Mapper(componentModel = "spring")
14
public interface TxMapper {
15
16
  @Mapping(target = "epochNo", source = "block.epochNo")
17
  @Mapping(target = "epochSlotNo", source = "block.epochSlotNo")
18
  @Mapping(target = "slot", source = "block.slotNo")
19
  @Mapping(target = "blockNo", source = "block.blockNo")
20
  @Mapping(target = "blockHash", source = "block.hash")
21
  @Mapping(target = "time", source = "block.time")
22
  TxFilterResponse txToTxFilterResponse(Tx tx);
23
24
  @Mapping(target = "tx.hash", source = "hash")
25
  @Mapping(target = "tx.blockNo", source = "block.blockNo")
26
  @Mapping(target = "tx.blockHash", source = "block.hash")
27
  @Mapping(target = "tx.epochSlot", source = "block.epochSlotNo")
28
  @Mapping(target = "tx.epochNo", source = "block.epochNo")
29
  @Mapping(target = "tx.time", source = "block.time")
30
  @Mapping(target = "tx.fee", source = "fee")
31
  @Mapping(target = "tx.slotNo", source = "block.slotNo")
32
  TxResponse txToTxResponse(Tx tx);
33
34
  default LocalDateTime fromTimestamp(Timestamp timestamp) {
35 2 1. fromTimestamp : replaced return value with null for org/cardanofoundation/explorer/api/mapper/TxMapper::fromTimestamp → NO_COVERAGE
2. fromTimestamp : negated conditional → NO_COVERAGE
    return timestamp == null ? null : timestamp.toLocalDateTime();
36
  }
37
}

Mutations

35

1.1
Location : fromTimestamp
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/TxMapper::fromTimestamp → NO_COVERAGE

2.2
Location : fromTimestamp
Killed by : none
negated conditional → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.14.2