ZipWithIndexMappingGatherer.java

1
package com.pivovarit.gatherers;
2
3
import java.util.Objects;
4
import java.util.concurrent.atomic.AtomicLong;
5
import java.util.function.BiFunction;
6
import java.util.function.Supplier;
7
import java.util.stream.Gatherer;
8
9
record ZipWithIndexMappingGatherer<T, R>(BiFunction<Long, ? super T, ? extends R> mapper)
10
  implements Gatherer<T, AtomicLong, R> {
11
12
    ZipWithIndexMappingGatherer {
13
        Objects.requireNonNull(mapper, "mapper can't be null");
14
    }
15
16
    @Override
17
    public Supplier<AtomicLong> initializer() {
18 1 1. initializer : replaced return value with null for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::initializer → KILLED
        return AtomicLong::new;
19
    }
20
21
    @Override
22
    public Integrator<AtomicLong, T, R> integrator() {
23 3 1. lambda$integrator$0 : replaced boolean return with true for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::lambda$integrator$0 → SURVIVED
2. lambda$integrator$0 : replaced boolean return with false for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::lambda$integrator$0 → SURVIVED
3. integrator : replaced return value with null for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::integrator → KILLED
        return Integrator.ofGreedy((state, element, downstream) -> downstream.push(mapper.apply(state.getAndIncrement(), element)));
24
    }
25
}

Mutations

18

1.1
Location : initializer
Killed by : com.pivovarit.gatherers.blackbox.ZipWithIndexMapperTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipWithIndexMapperTest]/[method:shouldZipEmptyStream()]
replaced return value with null for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::initializer → KILLED

23

1.1
Location : lambda$integrator$0
Killed by : none
replaced boolean return with true for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::lambda$integrator$0 → SURVIVED
Covering tests

2.2
Location : integrator
Killed by : com.pivovarit.gatherers.blackbox.ZipWithIndexMapperTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipWithIndexMapperTest]/[method:shouldZipWithIndex()]
replaced return value with null for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::integrator → KILLED

3.3
Location : lambda$integrator$0
Killed by : none
replaced boolean return with false for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::lambda$integrator$0 → SURVIVED Covering tests

Active mutators

Tests examined


Report generated by PIT 1.17.1