| 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 |
|
| 19 |
1.1 |
|
| 21 |
1.1 2.2 |