ListChecker.java

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

Mutations

27

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

31

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

35

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

40

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

45

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

47

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

2.2
Location : lambda$null$0
Killed by : none
replaced boolean return with false for com/github/dakusui/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/dakusui/pcond/core/fluent/builtins/ListChecker::lambda$null$0 → NO_COVERAGE

48

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

66

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

Active mutators

Tests examined


Report generated by PIT 1.7.3