ListTransformer.java

1
package com.github.dakusui.pcond.core.fluent.builtins;
2
3
import com.github.dakusui.pcond.core.fluent.AbstractObjectTransformer;
4
import com.github.dakusui.pcond.core.fluent.Matcher;
5
import com.github.dakusui.pcond.forms.Functions;
6
import com.github.dakusui.pcond.forms.Printables;
7
8
import java.util.Collection;
9
import java.util.List;
10
import java.util.function.Function;
11
import java.util.function.Predicate;
12
import java.util.function.Supplier;
13
14
import static com.github.dakusui.pcond.internals.InternalUtils.trivialIdentityFunction;
15
16
public interface ListTransformer<
17
    T,
18
    E
19
    > extends
20
    AbstractObjectTransformer<
21
        ListTransformer<T, E>,
22
        ListChecker<T, E>,
23
        T,
24
        List<E>> {
25
  static <E> ListTransformer<List<E>, E> create(Supplier<List<E>> value) {
26 1 1. create : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::create → KILLED
    return new Impl<>(value, trivialIdentityFunction());
27
  }
28
29
  @SuppressWarnings("unchecked")
30
  default ListTransformer<T, E> transform(Function<ListTransformer<T, E>, Predicate<List<E>>> clause) {
31 2 1. lambda$transform$0 : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::lambda$transform$0 → NO_COVERAGE
2. transform : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::transform → NO_COVERAGE
    return this.addTransformAndCheckClause(tx -> clause.apply((ListTransformer<T, E>) tx));
32
  }
33
34
  default ObjectTransformer<T, E> elementAt(int i) {
35 1 1. elementAt : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::elementAt → KILLED
    return this.toObject(Functions.elementAt(i));
36
  }
37
38
  default IntegerTransformer<T> size() {
39 1 1. size : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::size → KILLED
    return this.toInteger(Functions.size());
40
  }
41
42
  default ListTransformer<T, E> subList(int begin, int end) {
43 2 1. lambda$subList$1 : replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::lambda$subList$1 → NO_COVERAGE
2. subList : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::subList → KILLED
    return this.toList(Printables.function("subList[" + begin + "," + end + "]", v -> v.subList(begin, end)));
44
  }
45
46
  default ListTransformer<T, E> subList(int begin) {
47 2 1. lambda$subList$2 : replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::lambda$subList$2 → NO_COVERAGE
2. subList : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::subList → KILLED
    return this.toList(Printables.function("subList[" + begin + "]", v -> v.subList(begin, v.size())));
48
  }
49
50
  default StreamTransformer<T, E> stream() {
51 1 1. stream : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::stream → KILLED
    return this.toStream(Printables.function("listStream", Collection::stream));
52
  }
53
54
  default BooleanTransformer<T> isEmpty() {
55 1 1. isEmpty : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::isEmpty → KILLED
    return this.toBoolean(Printables.function("listIsEmpty", List::isEmpty));
56
  }
57
58
  class Impl<T, E> extends
59
      Base<
60
          ListTransformer<T, E>,
61
          ListChecker<T, E>,
62
          T,
63
          List<E>> implements
64
      ListTransformer<T, E> {
65
    public Impl(Supplier<T> value, Function<T, List<E>> transformFunction) {
66
      super(value, transformFunction);
67
    }
68
69
    @Override
70
    protected ListChecker<T, E> toChecker(Function<T, List<E>> transformFunction) {
71 1 1. toChecker : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer$Impl::toChecker → KILLED
      return new ListChecker.Impl<>(this::baseValue, transformFunction);
72
    }
73
74
    @Override
75
    protected Matcher<?, List<E>, List<E>> rebase() {
76 1 1. rebase : replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer$Impl::rebase → NO_COVERAGE
      return new Impl<>(this::value, trivialIdentityFunction());
77
    }
78
  }
79
}

Mutations

26

1.1
Location : create
Killed by : com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.list_assertThatTest_passed(com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::create → KILLED

31

1.1
Location : lambda$transform$0
Killed by : none
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::lambda$transform$0 → NO_COVERAGE

2.2
Location : transform
Killed by : none
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::transform → NO_COVERAGE

35

1.1
Location : elementAt
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_elementAt(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::elementAt → KILLED

39

1.1
Location : size
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_size(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::size → KILLED

43

1.1
Location : lambda$subList$1
Killed by : none
replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::lambda$subList$1 → NO_COVERAGE

2.2
Location : subList
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/ListTransformer::subList → KILLED

47

1.1
Location : lambda$subList$2
Killed by : none
replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::lambda$subList$2 → NO_COVERAGE

2.2
Location : subList
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/ListTransformer::subList → KILLED

51

1.1
Location : stream
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_stream(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::stream → KILLED

55

1.1
Location : isEmpty
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_isEmpty(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer::isEmpty → KILLED

71

1.1
Location : toChecker
Killed by : com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.list_assertThatTest_passed(com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/builtins/ListTransformer$Impl::toChecker → KILLED

76

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

Active mutators

Tests examined


Report generated by PIT 1.7.3