1 | package org.hplr.elo.core.usecases.service; | |
2 | ||
3 | import org.hplr.elo.core.usecases.port.in.CalculateScoreForGameUseCaseInterface; | |
4 | import org.springframework.stereotype.Service; | |
5 | ||
6 | import java.util.List; | |
7 | import java.util.Optional; | |
8 | ||
9 | @Service | |
10 | public class CalculateScoreForGameUseCaseService implements CalculateScoreForGameUseCaseInterface { | |
11 | @Override | |
12 | public Long calculateScoreForGame(List<Long> firstSideScore, List<Long> secondSideScore) { | |
13 | Optional<Long> firstSideScoreSum = firstSideScore | |
14 | .stream() | |
15 | .reduce(Long::sum); | |
16 | Optional<Long> secondSideScoreSum = secondSideScore | |
17 | .stream() | |
18 | .reduce(Long::sum); | |
19 |
2
1. calculateScoreForGame : negated conditional → KILLED 2. calculateScoreForGame : negated conditional → KILLED |
if(firstSideScoreSum.isPresent() && secondSideScoreSum.isPresent()){ |
20 |
2
1. calculateScoreForGame : replaced Long return value with 0L for org/hplr/elo/core/usecases/service/CalculateScoreForGameUseCaseService::calculateScoreForGame → KILLED 2. calculateScoreForGame : Replaced long subtraction with addition → KILLED |
return firstSideScoreSum.get() - secondSideScoreSum.get(); |
21 | } | |
22 |
1
1. calculateScoreForGame : replaced Long return value with 0L for org/hplr/elo/core/usecases/service/CalculateScoreForGameUseCaseService::calculateScoreForGame → KILLED |
return null; |
23 | } | |
24 | } | |
Mutations | ||
19 |
1.1 2.2 |
|
20 |
1.1 2.2 |
|
22 |
1.1 |