LongPrimaryKeyGenerator.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 long integers.
7
 *
8
 * @author RealLifeDeveloper
9
 *
10
 */
11
public class LongPrimaryKeyGenerator implements PrimaryKeyGenerator<Long> {
12
13
    /**
14
     * {@inheritDoc}
15
     */
16
    @Override
17
    public Long nextPrimaryKey(@Nullable Long previousMax) {
18 1 1. nextPrimaryKey : negated conditional → KILLED
        if (previousMax == null) {
19 1 1. nextPrimaryKey : replaced Long return value with 0L for com/reallifedeveloper/tools/test/database/inmemory/LongPrimaryKeyGenerator::nextPrimaryKey → KILLED
            return 1L;
20
        } else {
21 2 1. nextPrimaryKey : Replaced long addition with subtraction → RUN_ERROR
2. nextPrimaryKey : replaced Long return value with 0L for com/reallifedeveloper/tools/test/database/inmemory/LongPrimaryKeyGenerator::nextPrimaryKey → 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:saveNullPrimaryKeyWithGeneratorAndMethodAnnotations()]
negated conditional → KILLED

19

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:saveNullPrimaryKeyWithGeneratorAndMethodAnnotations()]
replaced Long return value with 0L for com/reallifedeveloper/tools/test/database/inmemory/LongPrimaryKeyGenerator::nextPrimaryKey → KILLED

21

1.1
Location : nextPrimaryKey
Killed by : none
Replaced long addition with subtraction → RUN_ERROR

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:saveNullPrimaryKeyWithGeneratorAndMethodAnnotations()]
replaced Long return value with 0L for com/reallifedeveloper/tools/test/database/inmemory/LongPrimaryKeyGenerator::nextPrimaryKey → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.2