Preconditions.java

1
package com.pivovarit.collectors;
2
3
import java.util.concurrent.Executor;
4
import java.util.concurrent.ThreadPoolExecutor;
5
6
final class Preconditions {
7
8
    private Preconditions() {
9
    }
10
11
    static void requireValidParallelism(int parallelism) {
12 2 1. requireValidParallelism : negated conditional → TIMED_OUT
2. requireValidParallelism : changed conditional boundary → KILLED
        if (parallelism < 1) {
13
            throw new IllegalArgumentException("Parallelism can't be lower than 1");
14
        }
15
    }
16
17
    static void requireValidExecutor(Executor executor) {
18 1 1. requireValidExecutor : negated conditional → KILLED
        if (executor instanceof ThreadPoolExecutor tpe) {
19
            switch (tpe.getRejectedExecutionHandler()) {
20
                case ThreadPoolExecutor.DiscardPolicy __ ->
21
                  throw new IllegalArgumentException("Executor's RejectedExecutionHandler can't discard tasks");
22
                case ThreadPoolExecutor.DiscardOldestPolicy __ ->
23
                  throw new IllegalArgumentException("Executor's RejectedExecutionHandler can't discard tasks");
24
                default -> {
25
                    // no-op
26
                }
27
            }
28
        }
29
    }
30
}

Mutations

12

1.1
Location : requireValidParallelism
Killed by : none
negated conditional → TIMED_OUT

2.2
Location : requireValidParallelism
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#11]
changed conditional boundary → KILLED

18

1.1
Location : requireValidExecutor
Killed by : com.pivovarit.collectors.test.ExecutorValidationTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.ExecutorValidationTest]/[test-factory:shouldRejectInvalidRejectedExecutionHandlerFactory()]/[dynamic-test:#2]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.3