IntegerPrimaryKeyGenerator.java

1
package com.reallifedeveloper.tools.test.database.inmemory;
2
3
import org.checkerframework.checker.nullness.qual.Nullable;
4
5
/**
6
 * A primary key generator that generates a sequence of integers.
7
 *
8
 * @author RealLifeDeveloper
9
 *
10
 */
11
public class IntegerPrimaryKeyGenerator implements PrimaryKeyGenerator<Integer> {
12
13
    /**
14
     * {@inheritDoc}
15
     */
16
    @Override
17
    public Integer nextPrimaryKey(@Nullable Integer previousMax) {
18 1 1. nextPrimaryKey : negated conditional → KILLED
        if (previousMax == null) {
19 1 1. nextPrimaryKey : replaced Integer return value with 0 for com/reallifedeveloper/tools/test/database/inmemory/IntegerPrimaryKeyGenerator::nextPrimaryKey → RUN_ERROR
            return 1;
20
        } else {
21 2 1. nextPrimaryKey : replaced Integer return value with 0 for com/reallifedeveloper/tools/test/database/inmemory/IntegerPrimaryKeyGenerator::nextPrimaryKey → KILLED
2. nextPrimaryKey : Replaced integer addition with subtraction → KILLED
            return previousMax + 1;
22
        }
23
    }
24
}

Mutations

18

1.1
Location : nextPrimaryKey
Killed by : com.reallifedeveloper.tools.test.database.inmemory.InMemoryJpaRepositoryTest.[engine:junit-jupiter]/[class:com.reallifedeveloper.tools.test.database.inmemory.InMemoryJpaRepositoryTest]/[method:saveNullPrimaryKeyWithGenerator()]
negated conditional → KILLED

19

1.1
Location : nextPrimaryKey
Killed by : none
replaced Integer return value with 0 for com/reallifedeveloper/tools/test/database/inmemory/IntegerPrimaryKeyGenerator::nextPrimaryKey → RUN_ERROR

21

1.1
Location : nextPrimaryKey
Killed by : com.reallifedeveloper.tools.test.database.inmemory.InMemoryJpaRepositoryTest.[engine:junit-jupiter]/[class:com.reallifedeveloper.tools.test.database.inmemory.InMemoryJpaRepositoryTest]/[method:saveNullPrimaryKeyWithGenerator()]
replaced Integer return value with 0 for com/reallifedeveloper/tools/test/database/inmemory/IntegerPrimaryKeyGenerator::nextPrimaryKey → KILLED

2.2
Location : nextPrimaryKey
Killed by : com.reallifedeveloper.tools.test.database.inmemory.InMemoryJpaRepositoryTest.[engine:junit-jupiter]/[class:com.reallifedeveloper.tools.test.database.inmemory.InMemoryJpaRepositoryTest]/[method:saveNullPrimaryKeyWithGenerator()]
Replaced integer addition with subtraction → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.2