YMPair.java

1
package io.github.mathieusoysal.yatzy_mod;
2
3
import io.github.mathieusoysal.Dices;
4
5
/**
6
 * The {@code YMPair} class represents the "Pair" category in the Yatzy game.
7
 * 
8
 * <p>
9
 * In the "Pair" category, the player scores the sum of the two highest
10
 * matching dice values.
11
 * </p>
12
 *
13
 * @author MathieuSoysal
14
 * @see YatzyModInterface
15
 * @see YatzyModUtils
16
 */
17
class YMPair implements YatzyModInterface {
18
19
    /**
20
     * Calculates the score for the "Pair" category based on the sum of the two
21
     * highest matching dice values.
22
     *
23
     * @param dices The set of dice to calculate the score for.
24
     * @return The calculated score, which is the sum of the two highest matching
25
     *         dice values, or zero if not possible.
26
     * @see YatzyModUtils#filterByFrequency(int, Dices)
27
     */
28
    @Override
29
    public int calculateScore(Dices dices) {
30 1 1. calculateScore : replaced int return with 0 for io/github/mathieusoysal/yatzy_mod/YMPair::calculateScore → KILLED
        return YatzyModUtils.filterByFrequency(2, dices)
31
                .max()
32 1 1. calculateScore : Replaced integer multiplication with division → KILLED
                .orElse(0) * 2;
33
    }
34
}

Mutations

30

1.1
Location : calculateScore
Killed by : io.github.mathieusoysal.YatzyTest.[engine:junit-jupiter]/[class:io.github.mathieusoysal.YatzyTest]/[test-template:test_onePair(int, int, int, int, int, int)]/[test-template-invocation:#2]
replaced int return with 0 for io/github/mathieusoysal/yatzy_mod/YMPair::calculateScore → KILLED

32

1.1
Location : calculateScore
Killed by : io.github.mathieusoysal.YatzyTest.[engine:junit-jupiter]/[class:io.github.mathieusoysal.YatzyTest]/[test-template:test_onePair(int, int, int, int, int, int)]/[test-template-invocation:#2]
Replaced integer multiplication with division → KILLED

Active mutators

Tests examined


Report generated by PIT 1.15.0