CalculateScoreForGameUseCaseService.java

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
Location : calculateScoreForGame
Killed by : org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests.[engine:junit-jupiter]/[class:org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests]/[method:get_elo_and_succeed()]
negated conditional → KILLED

2.2
Location : calculateScoreForGame
Killed by : org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests.[engine:junit-jupiter]/[class:org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests]/[method:get_elo_and_succeed()]
negated conditional → KILLED

20

1.1
Location : calculateScoreForGame
Killed by : org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests.[engine:junit-jupiter]/[class:org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests]/[method:get_elo_and_succeed()]
replaced Long return value with 0L for org/hplr/elo/core/usecases/service/CalculateScoreForGameUseCaseService::calculateScoreForGame → KILLED

2.2
Location : calculateScoreForGame
Killed by : org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests.[engine:junit-jupiter]/[class:org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests]/[method:get_elo_and_succeed()]
Replaced long subtraction with addition → KILLED

22

1.1
Location : calculateScoreForGame
Killed by : org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests.[engine:junit-jupiter]/[class:org.hplr.elo.core.usecases.service.CalculateScoreForGameUseCaseServiceTests]/[method:get_no_elo_and_get_null_and_fail()]
replaced Long return value with 0L for org/hplr/elo/core/usecases/service/CalculateScoreForGameUseCaseService::calculateScoreForGame → KILLED

Active mutators

Tests examined


Report generated by PIT 1.16.1