1 | package org.cardanofoundation.explorer.api.mapper; | |
2 | ||
3 | import javax.annotation.processing.Generated; | |
4 | import org.cardanofoundation.explorer.api.model.response.BlockFilterResponse; | |
5 | import org.cardanofoundation.explorer.api.model.response.BlockResponse; | |
6 | import org.cardanofoundation.explorer.common.entity.ledgersync.Block; | |
7 | import org.cardanofoundation.explorer.common.entity.ledgersync.SlotLeader; | |
8 | import org.springframework.stereotype.Component; | |
9 | ||
10 | @Generated( | |
11 | value = "org.mapstruct.ap.MappingProcessor", | |
12 | date = "2024-11-05T06:00:28+0000", | |
13 | comments = "version: 1.5.3.Final, compiler: javac, environment: Java 18.0.2.1 (Eclipse Adoptium)" | |
14 | ) | |
15 | @Component | |
16 | public class BlockMapperImpl implements BlockMapper { | |
17 | ||
18 | @Override | |
19 | public BlockResponse blockToBlockResponse(Block block) { | |
20 |
1
1. blockToBlockResponse : negated conditional → NO_COVERAGE |
if ( block == null ) { |
21 | return null; | |
22 | } | |
23 | ||
24 | BlockResponse.BlockResponseBuilder blockResponse = BlockResponse.builder(); | |
25 | ||
26 | blockResponse.slotLeader( blockSlotLeaderHash( block ) ); | |
27 | blockResponse.hash( block.getHash() ); | |
28 | blockResponse.time( fromTimestamp( block.getTime() ) ); | |
29 | blockResponse.txCount( block.getTxCount() ); | |
30 | blockResponse.epochNo( block.getEpochNo() ); | |
31 |
1
1. blockToBlockResponse : negated conditional → NO_COVERAGE |
if ( block.getBlockNo() != null ) { |
32 | blockResponse.blockNo( block.getBlockNo().intValue() ); | |
33 | } | |
34 | blockResponse.slotNo( block.getSlotNo() ); | |
35 | blockResponse.epochSlotNo( block.getEpochSlotNo() ); | |
36 | ||
37 |
1
1. blockToBlockResponse : replaced return value with null for org/cardanofoundation/explorer/api/mapper/BlockMapperImpl::blockToBlockResponse → NO_COVERAGE |
return blockResponse.build(); |
38 | } | |
39 | ||
40 | @Override | |
41 | public BlockFilterResponse blockToBlockFilterResponse(Block block) { | |
42 |
1
1. blockToBlockFilterResponse : negated conditional → NO_COVERAGE |
if ( block == null ) { |
43 | return null; | |
44 | } | |
45 | ||
46 | BlockFilterResponse blockFilterResponse = new BlockFilterResponse(); | |
47 | ||
48 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setSlotLeader → NO_COVERAGE |
blockFilterResponse.setSlotLeader( blockSlotLeaderHash( block ) ); |
49 |
1
1. blockToBlockFilterResponse : negated conditional → NO_COVERAGE |
if ( block.getBlockNo() != null ) { |
50 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setBlockNo → NO_COVERAGE |
blockFilterResponse.setBlockNo( block.getBlockNo().intValue() ); |
51 | } | |
52 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setSlotNo → NO_COVERAGE |
blockFilterResponse.setSlotNo( block.getSlotNo() ); |
53 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setEpochNo → NO_COVERAGE |
blockFilterResponse.setEpochNo( block.getEpochNo() ); |
54 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setEpochSlotNo → NO_COVERAGE |
blockFilterResponse.setEpochSlotNo( block.getEpochSlotNo() ); |
55 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setHash → NO_COVERAGE |
blockFilterResponse.setHash( block.getHash() ); |
56 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setTime → NO_COVERAGE |
blockFilterResponse.setTime( fromTimestamp( block.getTime() ) ); |
57 |
1
1. blockToBlockFilterResponse : removed call to org/cardanofoundation/explorer/api/model/response/BlockFilterResponse::setTxCount → NO_COVERAGE |
blockFilterResponse.setTxCount( block.getTxCount() ); |
58 | ||
59 |
1
1. blockToBlockFilterResponse : replaced return value with null for org/cardanofoundation/explorer/api/mapper/BlockMapperImpl::blockToBlockFilterResponse → NO_COVERAGE |
return blockFilterResponse; |
60 | } | |
61 | ||
62 | private String blockSlotLeaderHash(Block block) { | |
63 |
1
1. blockSlotLeaderHash : negated conditional → NO_COVERAGE |
if ( block == null ) { |
64 |
1
1. blockSlotLeaderHash : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/BlockMapperImpl::blockSlotLeaderHash → NO_COVERAGE |
return null; |
65 | } | |
66 | SlotLeader slotLeader = block.getSlotLeader(); | |
67 |
1
1. blockSlotLeaderHash : negated conditional → NO_COVERAGE |
if ( slotLeader == null ) { |
68 |
1
1. blockSlotLeaderHash : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/BlockMapperImpl::blockSlotLeaderHash → NO_COVERAGE |
return null; |
69 | } | |
70 | String hash = slotLeader.getHash(); | |
71 |
1
1. blockSlotLeaderHash : negated conditional → NO_COVERAGE |
if ( hash == null ) { |
72 |
1
1. blockSlotLeaderHash : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/BlockMapperImpl::blockSlotLeaderHash → NO_COVERAGE |
return null; |
73 | } | |
74 |
1
1. blockSlotLeaderHash : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/BlockMapperImpl::blockSlotLeaderHash → NO_COVERAGE |
return hash; |
75 | } | |
76 | } | |
Mutations | ||
20 |
1.1 |
|
31 |
1.1 |
|
37 |
1.1 |
|
42 |
1.1 |
|
48 |
1.1 |
|
49 |
1.1 |
|
50 |
1.1 |
|
52 |
1.1 |
|
53 |
1.1 |
|
54 |
1.1 |
|
55 |
1.1 |
|
56 |
1.1 |
|
57 |
1.1 |
|
59 |
1.1 |
|
63 |
1.1 |
|
64 |
1.1 |
|
67 |
1.1 |
|
68 |
1.1 |
|
71 |
1.1 |
|
72 |
1.1 |
|
74 |
1.1 |