1 | package org.cardanofoundation.explorer.api.service.impl; | |
2 | ||
3 | import static org.cardanofoundation.explorer.api.common.constant.CommonConstant.REPORT_LIMIT_PER_24HOURS; | |
4 | import static org.cardanofoundation.explorer.api.common.constant.CommonConstant.UNLIMITED_REPORT; | |
5 | ||
6 | import java.util.Map; | |
7 | import java.util.Objects; | |
8 | ||
9 | import lombok.RequiredArgsConstructor; | |
10 | ||
11 | import org.springframework.stereotype.Service; | |
12 | ||
13 | import org.cardanofoundation.explorer.api.service.RoleService; | |
14 | ||
15 | @Service | |
16 | @RequiredArgsConstructor | |
17 | public class RoleServiceImpl implements RoleService { | |
18 | ||
19 | public int getReportLimit(Map<String, Map<String, Object>> roleDescriptions) { | |
20 | int maxReportLimit = 0; | |
21 |
1
1. getReportLimit : negated conditional → KILLED |
if (Objects.nonNull(roleDescriptions)) { |
22 | for (String role : roleDescriptions.keySet()) { | |
23 | Map<String, Object> descriptions = roleDescriptions.get(role); | |
24 |
2
1. getReportLimit : negated conditional → KILLED 2. getReportLimit : negated conditional → KILLED |
if (Objects.nonNull(descriptions) && descriptions.containsKey(REPORT_LIMIT_PER_24HOURS)) { |
25 | int reportLimit = (int) descriptions.get(REPORT_LIMIT_PER_24HOURS); | |
26 |
1
1. getReportLimit : negated conditional → KILLED |
if (reportLimit == UNLIMITED_REPORT) { // if report limit is equal -1 then |
27 |
1
1. getReportLimit : replaced int return with 0 for org/cardanofoundation/explorer/api/service/impl/RoleServiceImpl::getReportLimit → NO_COVERAGE |
return UNLIMITED_REPORT; |
28 | } | |
29 | maxReportLimit = Math.max(maxReportLimit, reportLimit); | |
30 | } | |
31 | } | |
32 | } | |
33 |
1
1. getReportLimit : replaced int return with 0 for org/cardanofoundation/explorer/api/service/impl/RoleServiceImpl::getReportLimit → KILLED |
return maxReportLimit; |
34 | } | |
35 | } | |
Mutations | ||
21 |
1.1 |
|
24 |
1.1 2.2 |
|
26 |
1.1 |
|
27 |
1.1 |
|
33 |
1.1 |