ListChecker.java

1
package com.github.valid8j.pcond.core.fluent.builtins;
2
3
import com.github.valid8j.pcond.core.fluent.AbstractObjectChecker;
4
import com.github.valid8j.pcond.experimentals.cursor.Cursors;
5
import com.github.valid8j.pcond.forms.Predicates;
6
import com.github.valid8j.pcond.forms.Printables;
7
import com.github.valid8j.pcond.internals.InternalUtils;
8
9
import java.util.Arrays;
10
import java.util.List;
11
import java.util.Objects;
12
import java.util.function.Function;
13
import java.util.function.Predicate;
14
import java.util.function.Supplier;
15
import java.util.stream.Collectors;
16
17
public interface ListChecker<
18
    T,
19
    E
20
    > extends
21
    AbstractObjectChecker<
22
                    ListChecker<T, E>,
23
                    T,
24
                    List<E>> {
25
  default ListChecker<T, E> empty() {
26 1 1. empty : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::empty → KILLED
    return checkWithPredicate(Predicates.isEmpty());
27
  }
28
29
  default ListChecker<T, E> notEmpty() {
30 1 1. notEmpty : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::notEmpty → KILLED
    return checkWithPredicate(Predicates.not(Predicates.isEmpty()));
31
  }
32
33
  default ListChecker<T, E> containing(E element) {
34 1 1. containing : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::containing → KILLED
    return checkWithPredicate(Predicates.contains(element));
35
  }
36
37
  @SuppressWarnings("unchecked")
38
  default ListChecker<T, E> containingElementsInOrder(List<Predicate<E>> predicates) {
39 1 1. containingElementsInOrder : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::containingElementsInOrder → KILLED
    return checkWithPredicate(Cursors.findElements(predicates.toArray(new Predicate[0])));
40
  }
41
42
  @SuppressWarnings("unchecked")
43
  default ListChecker<T, E> containingElementsInOrder(E... elements) {
44 1 1. containingElementsInOrder : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::containingElementsInOrder → KILLED
    return this.containingElementsInOrder(
45
        Arrays.stream(elements)
46 3 1. lambda$containingElementsInOrder$1 : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$containingElementsInOrder$1 → SURVIVED
2. lambda$null$0 : replaced boolean return with false for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$null$0 → NO_COVERAGE
3. lambda$null$0 : replaced boolean return with true for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$null$0 → NO_COVERAGE
            .map(v -> Printables.predicate("[" + v + "]", e -> Objects.equals(v, e)))
47 1 1. lambda$containingElementsInOrder$2 : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$containingElementsInOrder$2 → SURVIVED
            .map(p -> (Predicate<E>) p)
48
            .collect(Collectors.toList()));
49
  }
50
51
  class Impl<
52
      T,
53
      E
54
      > extends Base<
55
      ListChecker<T, E>,
56
      T,
57
      List<E>> implements
58
      ListChecker<T, E> {
59
    public Impl(Supplier<T> rootValue, Function<T, List<E>> transformFunction) {
60
      super(rootValue, transformFunction);
61
    }
62
63
    @Override
64
    protected ListChecker<List<E>, E> rebase() {
65 1 1. rebase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker$Impl::rebase → SURVIVED
      return new Impl<>(this::value, InternalUtils.trivialIdentityFunction());
66
    }
67
  }
68
}

Mutations

26

1.1
Location : empty
Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::empty → KILLED

30

1.1
Location : notEmpty
Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::notEmpty → KILLED

34

1.1
Location : containing
Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::containing → KILLED

39

1.1
Location : containingElementsInOrder
Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::containingElementsInOrder → KILLED

44

1.1
Location : containingElementsInOrder
Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::containingElementsInOrder → KILLED

46

1.1
Location : lambda$containingElementsInOrder$1
Killed by : none
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$containingElementsInOrder$1 → SURVIVED

2.2
Location : lambda$null$0
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$null$0 → NO_COVERAGE

3.3
Location : lambda$null$0
Killed by : none
replaced boolean return with true for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$null$0 → NO_COVERAGE

47

1.1
Location : lambda$containingElementsInOrder$2
Killed by : none
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker::lambda$containingElementsInOrder$2 → SURVIVED

65

1.1
Location : rebase
Killed by : none
replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/ListChecker$Impl::rebase → SURVIVED

Active mutators

Tests examined


Report generated by PIT 1.7.3