MetamorphicTestCaseFactoryWithPreformer.java

1
package com.github.valid8j.metamor;
2
3
4
import com.github.valid8j.metamor.internals.InternalUtils;
5
import com.github.valid8j.pcond.forms.Printables;
6
7
import java.text.MessageFormat;
8
import java.util.Arrays;
9
import java.util.Objects;
10
import java.util.function.Function;
11
import java.util.function.IntFunction;
12
import java.util.function.Predicate;
13
14
import static java.util.Objects.requireNonNull;
15
16
public interface MetamorphicTestCaseFactoryWithPreformer<X, I, O, P, R> extends MetamorphicTestCaseFactory<X, I, O, R> {
17
  Function<IoPair<I, O>, P> metamorphicPreformer();
18
19
  Function<Dataset<P>, R> metamorphicReducer();
20
21
  @Override
22
  default Function<Dataset<IoPair<I, O>>, R> metamorphicTransformer() {
23 1 1. metamorphicTransformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::metamorphicTransformer → KILLED
    return metamorphicPreformerStage().andThen(metamorphicReducer());
24
  }
25
26
  default Function<Dataset<IoPair<I, O>>, Dataset<P>> metamorphicPreformerStage() {
27 1 1. metamorphicPreformerStage : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::metamorphicPreformerStage → KILLED
    return InternalUtils.createObservableProcessingPipeline(
28
        "preform",
29
        metamorphicPreformerToIoContextCallback(metamorphicPreformer()),
30
        inputResolverSequenceFactory().count(),
31
        ioVariableNameFormatter(),
32
        ioVariableName());
33
  }
34
35
  default Function<IoContext<IoPair<I, O>, P>, Function<IoPair<I, O>, P>> metamorphicPreformerToIoContextCallback(Function<IoPair<I, O>, P> preformer) {
36 1 1. metamorphicPreformerToIoContextCallback : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::metamorphicPreformerToIoContextCallback → KILLED
    return Printables.function(
37 1 1. lambda$metamorphicPreformerToIoContextCallback$0 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::lambda$metamorphicPreformerToIoContextCallback$0 → SURVIVED
        () -> "  " + preformer,
38 1 1. lambda$metamorphicPreformerToIoContextCallback$2 : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::lambda$metamorphicPreformerToIoContextCallback$2 → KILLED
        c -> Printables.function(
39 1 1. lambda$null$1 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::lambda$null$1 → NO_COVERAGE
            () -> String.format("preform[%s]:%s", c, preformer),
40
            preformer));
41
  }
42
43
  IntFunction<String> ioVariableNameFormatter();
44
45
  class Impl<X, I, O, P, R> implements MetamorphicTestCaseFactoryWithPreformer<X, I, O, P, R> {
46
47
    private final Function<I, O>                          fut;
48
    private final InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory;
49
    private final Function<IoPair<I, O>, P>               preformer;
50
    private final Function<Dataset<P>, R>                 reducer;
51
    private final Predicate<R>                            checker;
52
    private final String                                  ioVariableName;
53
    private final String                                  inputVariableName;
54
55
    public Impl(Function<I, O> fut, InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory, Function<IoPair<I, O>, P> preformer, Function<Dataset<P>, R> reducer, Predicate<R> checker, String inputVariableName, String ioVariableName) {
56
      this.fut = requireNonNull(fut);
57
      this.inputResolverSequenceFactory = inputResolverSequenceFactory;
58
      this.preformer = requireNonNull(preformer);
59
      this.reducer = requireNonNull(reducer);
60
      this.checker = requireNonNull(checker);
61
      this.inputVariableName = requireNonNull(inputVariableName);
62
      this.ioVariableName = requireNonNull(ioVariableName);
63
    }
64
65
66
    @Override
67
    public Function<I, O> fut() {
68 1 1. fut : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::fut → KILLED
      return this.fut;
69
    }
70
71
    @Override
72
    public InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory() {
73 1 1. inputResolverSequenceFactory : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::inputResolverSequenceFactory → KILLED
      return this.inputResolverSequenceFactory;
74
    }
75
76
    @Override
77
    public Function<IoPair<I, O>, P> metamorphicPreformer() {
78 1 1. metamorphicPreformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::metamorphicPreformer → KILLED
      return this.preformer;
79
    }
80
81
    @Override
82
    public Function<Dataset<P>, R> metamorphicReducer() {
83 2 1. lambda$metamorphicReducer$0 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::lambda$metamorphicReducer$0 → SURVIVED
2. metamorphicReducer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::metamorphicReducer → KILLED
      return Printables.function(() -> "reduce:" + reducer, this.reducer);
84
    }
85
86
    @Override
87
    public Predicate<R> metamorphicChecker() {
88 1 1. metamorphicChecker : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::metamorphicChecker → KILLED
      return this.checker;
89
    }
90
91
    @Override
92
    public String inputVariableName() {
93 1 1. inputVariableName : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::inputVariableName → NO_COVERAGE
      return this.inputVariableName;
94
    }
95
96
    @Override
97
    public IntFunction<String> inputVariableNameFormatter() {
98 2 1. lambda$inputVariableNameFormatter$1 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::lambda$inputVariableNameFormatter$1 → SURVIVED
2. inputVariableNameFormatter : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::inputVariableNameFormatter → KILLED
      return i -> this.inputVariableName + "[" + i + "]";
99
    }
100
101
    @Override
102
    public String ioVariableName() {
103 1 1. ioVariableName : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::ioVariableName → SURVIVED
      return this.ioVariableName;
104
    }
105
106
    @Override
107
    public IntFunction<String> ioVariableNameFormatter() {
108 2 1. lambda$ioVariableNameFormatter$2 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::lambda$ioVariableNameFormatter$2 → SURVIVED
2. ioVariableNameFormatter : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::ioVariableNameFormatter → KILLED
      return i -> this.ioVariableName + "[" + i + "]";
109
    }
110
  }
111
112
  class Builder<X, I, O, P, R> extends BuilderBase<Builder<X, I, O, P, R>, X, I, O, R> {
113
    private Function<Dataset<P>, R>   reducer;
114
    private Function<IoPair<I, O>, P> preformer;
115
116
    public Builder() {
117
    }
118
119
    @SuppressWarnings("unchecked")
120
    @Override
121
    public <BB extends BuilderBase<BB, XX, I, O, R>, XX> BB sourceValueType(XX sourceType) {
122 1 1. sourceValueType : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::sourceValueType → NO_COVERAGE
      return (BB) this.<Builder<XX, I, O, P, R>, XX>newBuilderWithSpecifiedSourceType(Builder::new);
123
    }
124
125
    @Override
126
    public <PP> Builder<X, I, O, PP, R> preformer(Function<IoPair<I, O>, PP> preformer) {
127
      Builder<X, I, O, PP, R> ret = this.withPreformer();
128
      ret.preformer = preformer;
129 1 1. preformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::preformer → KILLED
      return ret;
130
    }
131
132
    public <QQ> Builder<X, I, O, QQ, R> preform(Function<P, QQ> preformer) {
133
      Function<IoPair<I, O>, P> currentPreformer = this.preformer;
134 1 1. preform : negated conditional → KILLED
      if (currentPreformer == null)
135
        throw new IllegalStateException();
136
      Builder<X, I, O, QQ, R> ret = this.withPreformer();
137
      ret.preformer = currentPreformer.andThen(preformer);
138 1 1. preform : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::preform → KILLED
      return ret;
139
    }
140
141
    public <QQ> Builder<X, I, O, QQ, R> preform(String name, Function<P, QQ> preformer) {
142 1 1. preform : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::preform → KILLED
      return this.preform(Printables.function(name, preformer));
143
    }
144
145
    public Builder<X, I, O, P, R> reducer(Function<Dataset<P>, R> reducer) {
146
      this.reducer = requireNonNull(reducer);
147 1 1. reducer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::reducer → KILLED
      return this;
148
    }
149
150
    public Builder<X, I, O, P, R> reduce(Function<Dataset<P>, R> reducer) {
151 1 1. reduce : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::reduce → KILLED
      return this.reducer(reducer);
152
    }
153
154
    public Builder<X, I, O, P, R> reduce(String reducerName, Function<Dataset<P>, R> reducer) {
155 1 1. reduce : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::reduce → KILLED
      return this.reduce(Printables.function(reducerName, reducer));
156
    }
157
158
    public Builder<X, I, O, P, Proposition> propositionFactory(Function<Dataset<P>, Proposition> pf) {
159 1 1. propositionFactory : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::propositionFactory → KILLED
      return this
160
          .<Builder<X, I, O, P, Proposition>, Proposition>newBuilderWithSpecifiedRelationType(Builder::new)
161
          .preformer(this.preformer)
162
          .reducer(pf)
163
          .checker(PropositionPredicate.INSTANCE);
164
    }
165
166
    public MetamorphicTestCaseFactory<X, I, O, Proposition> proposition(Function<Object[], String> propositionFormatter, Predicate<Dataset<P>> p) {
167 1 1. proposition : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::proposition → KILLED
      return this.propositionFactory(
168
          Proposition.Factory.create(
169
              p,
170
              propositionFormatter,
171 1 1. lambda$proposition$0 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::lambda$proposition$0 → SURVIVED
              i -> this.outputVariableName + "[" + i + "]",
172
              this.inputResolverSequenceFactoryProvider.count()))
173
          .build();
174
    }
175
176
    public MetamorphicTestCaseFactory<X, I, O, Proposition> proposition(String propositionName, Predicate<Dataset<P>> p) {
177 2 1. lambda$proposition$1 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::lambda$proposition$1 → SURVIVED
2. proposition : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::proposition → KILLED
      return this.proposition(args -> MessageFormat.format(propositionName, Arrays.stream(args).map(Objects::toString).toArray()), p);
178
    }
179
180
    public MetamorphicTestCaseFactoryWithPreformer<X, I, O, P, R> build() {
181 1 1. build : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::build → KILLED
      return new Impl<>(fut, inputResolverSequenceFactoryProvider.get(), preformer, reducer, checker, inputVariableName, ioVariableName);
182
    }
183
  }
184
}

Mutations

23

1.1
Location : metamorphicTransformer
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::metamorphicTransformer → KILLED

27

1.1
Location : metamorphicPreformerStage
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::metamorphicPreformerStage → KILLED

36

1.1
Location : metamorphicPreformerToIoContextCallback
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::metamorphicPreformerToIoContextCallback → KILLED

37

1.1
Location : lambda$metamorphicPreformerToIoContextCallback$0
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::lambda$metamorphicPreformerToIoContextCallback$0 → SURVIVED

38

1.1
Location : lambda$metamorphicPreformerToIoContextCallback$2
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::lambda$metamorphicPreformerToIoContextCallback$2 → KILLED

39

1.1
Location : lambda$null$1
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer::lambda$null$1 → NO_COVERAGE

68

1.1
Location : fut
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::fut → KILLED

73

1.1
Location : inputResolverSequenceFactory
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::inputResolverSequenceFactory → KILLED

78

1.1
Location : metamorphicPreformer
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::metamorphicPreformer → KILLED

83

1.1
Location : lambda$metamorphicReducer$0
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::lambda$metamorphicReducer$0 → SURVIVED

2.2
Location : metamorphicReducer
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::metamorphicReducer → KILLED

88

1.1
Location : metamorphicChecker
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::metamorphicChecker → KILLED

93

1.1
Location : inputVariableName
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::inputVariableName → NO_COVERAGE

98

1.1
Location : inputVariableNameFormatter
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::inputVariableNameFormatter → KILLED

2.2
Location : lambda$inputVariableNameFormatter$1
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::lambda$inputVariableNameFormatter$1 → SURVIVED

103

1.1
Location : ioVariableName
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::ioVariableName → SURVIVED

108

1.1
Location : ioVariableNameFormatter
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::ioVariableNameFormatter → KILLED

2.2
Location : lambda$ioVariableNameFormatter$2
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Impl::lambda$ioVariableNameFormatter$2 → SURVIVED

122

1.1
Location : sourceValueType
Killed by : none
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::sourceValueType → NO_COVERAGE

129

1.1
Location : preformer
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::preformer → KILLED

134

1.1
Location : preform
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
negated conditional → KILLED

138

1.1
Location : preform
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::preform → KILLED

142

1.1
Location : preform
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::preform → KILLED

147

1.1
Location : reducer
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::reducer → KILLED

151

1.1
Location : reduce
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::reduce → KILLED

155

1.1
Location : reduce
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::reduce → KILLED

159

1.1
Location : propositionFactory
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::propositionFactory → KILLED

167

1.1
Location : proposition
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::proposition → KILLED

171

1.1
Location : lambda$proposition$0
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::lambda$proposition$0 → SURVIVED

177

1.1
Location : lambda$proposition$1
Killed by : none
replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::lambda$proposition$1 → SURVIVED

2.2
Location : proposition
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::proposition → KILLED

181

1.1
Location : build
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactoryWithPreformer$Builder::build → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3