| 1 | package com.github.valid8j.metamor; | |
| 2 | ||
| 3 | import com.github.valid8j.metamor.internals.InternalUtils; | |
| 4 | import com.github.valid8j.pcond.forms.Printables; | |
| 5 | ||
| 6 | import java.text.MessageFormat; | |
| 7 | import java.util.function.*; | |
| 8 | ||
| 9 | import static com.github.valid8j.pcond.forms.Predicates.transform; | |
| 10 | import static java.util.Objects.requireNonNull; | |
| 11 | ||
| 12 | /** | |
| 13 | * An interface of a factory for a metamorphic test case. | |
| 14 | * | |
| 15 | * @param <X> Type of "source value". | |
| 16 | * @param <I> Input type of the function under test. | |
| 17 | * @param <O> Output type of function under test. | |
| 18 | * @param <R> Input type of metamorphic relation. | |
| 19 | */ | |
| 20 | public interface MetamorphicTestCaseFactory<X, I, O, R> { | |
| 21 | /** | |
| 22 | * Returns a function under test. | |
| 23 | * | |
| 24 | * @return a function under test. | |
| 25 | */ | |
| 26 | Function<I, O> fut(); | |
| 27 | ||
| 28 | InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory(); | |
| 29 | ||
| 30 | Function<Dataset<IoPair<I, O>>, R> metamorphicTransformer(); | |
| 31 | ||
| 32 | Predicate<R> metamorphicChecker(); | |
| 33 | ||
| 34 | default Predicate<Dataset<IoPair<I, O>>> metamorphicRelation() { | |
| 35 |
1
1. metamorphicRelation : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::metamorphicRelation → KILLED |
return transform(metamorphicTransformer()).check(metamorphicChecker()); |
| 36 | } | |
| 37 | ||
| 38 | /** | |
| 39 | * Returns a function that executes the FUT for each element in `Dataset<InputResolver<I, O>>`. | |
| 40 | * | |
| 41 | * @return A function that executes the FUT for each element in `Dataset<InputResolver<I, O>>`. | |
| 42 | */ | |
| 43 | default Function<Dataset<InputResolver<I, O>>, Dataset<IoPair<I, O>>> metamorphicExecutor() { | |
| 44 |
1
1. metamorphicExecutor : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::metamorphicExecutor → KILLED |
return InternalUtils.createObservableProcessingPipeline("fut", this.metamorphicMapper(), this.inputResolverSequenceFactory().count(), inputVariableNameFormatter(), ioVariableName()); |
| 45 | } | |
| 46 | ||
| 47 | /** | |
| 48 | * A name of input variable. | |
| 49 | * This will be printed in the test report. | |
| 50 | * | |
| 51 | * @return A name of input variable. | |
| 52 | */ | |
| 53 | String inputVariableName(); | |
| 54 | ||
| 55 | /** | |
| 56 | * In metamorphic testing context, the function under test is executed multiple times with different input values. | |
| 57 | * The returned function renders input variable names so that they can be identified each other when an index is given. | |
| 58 | * By default, it returns a function that appends the given index. | |
| 59 | * | |
| 60 | * @return A function to render an input variable name corresponding to a given index. | |
| 61 | */ | |
| 62 | default IntFunction<String> inputVariableNameFormatter() { | |
| 63 |
2
1. lambda$inputVariableNameFormatter$0 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory::lambda$inputVariableNameFormatter$0 → SURVIVED 2. inputVariableNameFormatter : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::inputVariableNameFormatter → KILLED |
return i -> this.inputVariableName() + "[" + i + "]"; |
| 64 | } | |
| 65 | ||
| 66 | default Function<IoContext<InputResolver<I, O>, IoPair<I, O>>, Function<InputResolver<I, O>, IoPair<I, O>>> metamorphicMapper() { | |
| 67 |
1
1. metamorphicMapper : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::metamorphicMapper → KILLED |
return Printables.function( |
| 68 |
1
1. lambda$metamorphicMapper$1 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory::lambda$metamorphicMapper$1 → SURVIVED |
() -> " " + fut(), |
| 69 |
1
1. lambda$metamorphicMapper$4 : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::lambda$metamorphicMapper$4 → KILLED |
ioContext -> Printables.function( |
| 70 |
1
1. lambda$null$2 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory::lambda$null$2 → NO_COVERAGE |
() -> "input:" + ioContext.output(), |
| 71 | inputResolver -> { | |
| 72 | I in = inputResolver.apply(ioContext.output()); | |
| 73 |
1
1. lambda$null$3 : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::lambda$null$3 → KILLED |
return IoPair.create(in, fut().apply(in)); |
| 74 | })); | |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * A builder method that returns a printable predicate that examines the function under test. | |
| 79 | * | |
| 80 | * @return A printable predicate that examines FUT with a given metamorphic relation. | |
| 81 | */ | |
| 82 | default Predicate<X> toMetamorphicTestPredicate() { | |
| 83 |
1
1. toMetamorphicTestPredicate : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::toMetamorphicTestPredicate → KILLED |
return transform(this.inputResolverSequenceFactory().andThen(this.metamorphicExecutor())).check(this.metamorphicRelation()); |
| 84 | } | |
| 85 | ||
| 86 | String ioVariableName(); | |
| 87 | ||
| 88 | ||
| 89 | static <I, O> Builder<Object, I, O, Object> forFunctionUnderTest(String name, Function<I, O> fut) { | |
| 90 |
1
1. forFunctionUnderTest : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::forFunctionUnderTest → KILLED |
return forFunctionUnderTest(Printables.function(name, fut)); |
| 91 | } | |
| 92 | ||
| 93 | static <I, O> Builder<Object, I, O, Object> forFunctionUnderTest(Function<I, O> fut) { | |
| 94 |
1
1. forFunctionUnderTest : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory::forFunctionUnderTest → KILLED |
return new Builder<Object, I, O, Object>().fut(fut); |
| 95 | } | |
| 96 | ||
| 97 | class Impl<X, I, O, R> implements MetamorphicTestCaseFactory<X, I, O, R> { | |
| 98 | ||
| 99 | private final Function<I, O> fut; | |
| 100 | private final InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory; | |
| 101 | private final Function<Dataset<IoPair<I, O>>, R> metamorphicTransformer; | |
| 102 | private final Predicate<R> metamorphicChecker; | |
| 103 | private final String inputVariableName; | |
| 104 | private final String ioVariableName; | |
| 105 | ||
| 106 | public Impl(Function<I, O> fut, InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory, Function<Dataset<IoPair<I, O>>, R> metamorphicTransformer, Predicate<R> metamorphicChecker, String inputVariableName, String ioVariableName) { | |
| 107 | this.fut = fut; | |
| 108 | this.inputResolverSequenceFactory = inputResolverSequenceFactory; | |
| 109 | this.metamorphicTransformer = metamorphicTransformer; | |
| 110 | this.metamorphicChecker = metamorphicChecker; | |
| 111 | this.inputVariableName = inputVariableName; | |
| 112 | this.ioVariableName = ioVariableName; | |
| 113 | } | |
| 114 | ||
| 115 | @Override | |
| 116 | public Function<I, O> fut() { | |
| 117 |
1
1. fut : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Impl::fut → KILLED |
return this.fut; |
| 118 | } | |
| 119 | ||
| 120 | @Override | |
| 121 | public InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory() { | |
| 122 |
1
1. inputResolverSequenceFactory : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Impl::inputResolverSequenceFactory → KILLED |
return this.inputResolverSequenceFactory; |
| 123 | } | |
| 124 | ||
| 125 | @Override | |
| 126 | public Function<Dataset<IoPair<I, O>>, R> metamorphicTransformer() { | |
| 127 |
1
1. metamorphicTransformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Impl::metamorphicTransformer → KILLED |
return this.metamorphicTransformer; |
| 128 | } | |
| 129 | ||
| 130 | @Override | |
| 131 | public Predicate<R> metamorphicChecker() { | |
| 132 |
1
1. metamorphicChecker : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Impl::metamorphicChecker → KILLED |
return this.metamorphicChecker; |
| 133 | } | |
| 134 | ||
| 135 | @Override | |
| 136 | public String inputVariableName() { | |
| 137 |
1
1. inputVariableName : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Impl::inputVariableName → SURVIVED |
return this.inputVariableName; |
| 138 | } | |
| 139 | ||
| 140 | @Override | |
| 141 | public String ioVariableName() { | |
| 142 |
1
1. ioVariableName : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Impl::ioVariableName → SURVIVED |
return this.ioVariableName; |
| 143 | } | |
| 144 | ||
| 145 | } | |
| 146 | ||
| 147 | abstract class BuilderBase<B extends BuilderBase<B, X, I, O, R>, X, I, O, R> { | |
| 148 | abstract static class InputResolverSequenceFactoryProvider<X, I, O> implements Supplier<InputResolver.Sequence.Factory<X, I, O>> { | |
| 149 | final BuilderBase<?, X, I, O, ?> parent; | |
| 150 | ||
| 151 | protected InputResolverSequenceFactoryProvider(BuilderBase<?, X, I, O, ?> parent) { | |
| 152 | this.parent = parent; | |
| 153 | } | |
| 154 | ||
| 155 | abstract void add(Function<Object, String> formatter, Function<X, I> function); | |
| 156 | ||
| 157 | abstract int count(); | |
| 158 | } | |
| 159 | ||
| 160 | protected Function<I, O> fut; | |
| 161 | protected InputResolverSequenceFactoryProvider<X, I, O> inputResolverSequenceFactoryProvider; | |
| 162 | protected Predicate<R> checker; | |
| 163 | protected String sourceVariableName; | |
| 164 | protected String inputVariableName; | |
| 165 | protected String ioVariableName; | |
| 166 | protected String outputVariableName; | |
| 167 | ||
| 168 | protected BuilderBase() { | |
| 169 | this.sourceVariableName("x") | |
| 170 | .inputVariableName("input") | |
| 171 | .ioVariableName("io") | |
| 172 | .outputVariableName("out"); | |
| 173 | } | |
| 174 | ||
| 175 | protected <BB extends BuilderBase<BB, XX, I, O, RR>, XX, RR> BB newBuilder(Supplier<BB> constructor) { | |
| 176 |
1
1. newBuilder : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::newBuilder → KILLED |
return constructor.get() |
| 177 | .fut(this.fut) | |
| 178 | .sourceVariableName(this.sourceVariableName) | |
| 179 | .inputVariableName(this.inputVariableName) | |
| 180 | .ioVariableName(this.ioVariableName) | |
| 181 | .outputVariableName(this.outputVariableName); | |
| 182 | } | |
| 183 | ||
| 184 | protected <BB extends BuilderBase<BB, X, I, O, RR>, RR> BB newBuilderWithSpecifiedRelationType(Supplier<BB> constructor) { | |
| 185 |
1
1. newBuilderWithSpecifiedRelationType : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::newBuilderWithSpecifiedRelationType → KILLED |
return newBuilder(constructor) |
| 186 | .inputResolverSequenceFactoryProvider(this.inputResolverSequenceFactoryProvider); | |
| 187 | } | |
| 188 | ||
| 189 | protected <BB extends BuilderBase<BB, XX, I, O, R>, XX> BB newBuilderWithSpecifiedSourceType(Supplier<BB> constructor) { | |
| 190 |
1
1. newBuilderWithSpecifiedSourceType : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::newBuilderWithSpecifiedSourceType → KILLED |
return this.newBuilder(constructor); |
| 191 | } | |
| 192 | ||
| 193 | @SuppressWarnings("unchecked") | |
| 194 | public B sourceVariableName(String sourceVariableName) { | |
| 195 | this.sourceVariableName = sourceVariableName; | |
| 196 |
1
1. sourceVariableName : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::sourceVariableName → KILLED |
return (B) this; |
| 197 | } | |
| 198 | ||
| 199 | @SuppressWarnings("unchecked") | |
| 200 | public B inputVariableName(String inputVariableName) { | |
| 201 | this.inputVariableName = inputVariableName; | |
| 202 |
1
1. inputVariableName : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::inputVariableName → KILLED |
return (B) this; |
| 203 | } | |
| 204 | ||
| 205 | @SuppressWarnings("unchecked") | |
| 206 | public B outputVariableName(String outputVariableName) { | |
| 207 | this.outputVariableName = requireNonNull(outputVariableName); | |
| 208 |
1
1. outputVariableName : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::outputVariableName → KILLED |
return (B) this; |
| 209 | } | |
| 210 | ||
| 211 | @SuppressWarnings("unchecked") | |
| 212 | public B ioVariableName(String ioVariableName) { | |
| 213 | this.ioVariableName = requireNonNull(ioVariableName); | |
| 214 |
1
1. ioVariableName : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::ioVariableName → KILLED |
return (B) this; |
| 215 | } | |
| 216 | ||
| 217 | @SuppressWarnings("unchecked") | |
| 218 | B inputResolverSequenceFactoryProvider(InputResolverSequenceFactoryProvider<X, I, O> inputResolverSequenceFactory) { | |
| 219 | this.inputResolverSequenceFactoryProvider = requireNonNull(inputResolverSequenceFactory); | |
| 220 |
1
1. inputResolverSequenceFactoryProvider : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::inputResolverSequenceFactoryProvider → KILLED |
return (B) this; |
| 221 | } | |
| 222 | ||
| 223 | public B inputResolverSequenceFactory(InputResolver.Sequence.Factory<X, I, O> inputResolverSequenceFactory) { | |
| 224 |
2
1. inputResolverSequenceFactory : removed call to com/github/valid8j/metamor/Utils::requireState → SURVIVED 2. inputResolverSequenceFactory : negated conditional → KILLED |
Utils.requireState(this.inputResolverSequenceFactoryProvider == null, "Input Resolver Sequence Factory is already set."); |
| 225 |
1
1. inputResolverSequenceFactory : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::inputResolverSequenceFactory → KILLED |
return this.inputResolverSequenceFactoryProvider(new InputResolverSequenceFactoryProvider<X, I, O>(this) { |
| 226 | ||
| 227 | @Override | |
| 228 | public InputResolver.Sequence.Factory<X, I, O> get() { | |
| 229 |
1
1. get : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase$1::get → KILLED |
return inputResolverSequenceFactory; |
| 230 | } | |
| 231 | ||
| 232 | @Override | |
| 233 | void add(Function<Object, String> formatter, Function<X, I> function) { | |
| 234 | throw new IllegalStateException(); | |
| 235 | } | |
| 236 | ||
| 237 | @Override | |
| 238 | int count() { | |
| 239 |
1
1. count : replaced int return with 0 for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase$1::count → SURVIVED |
return inputResolverSequenceFactory.count(); |
| 240 | } | |
| 241 | }); | |
| 242 | } | |
| 243 | ||
| 244 | public B addInputResolvers(Function<InputResolver.Sequence.Factory.Builder<X, I, O>, InputResolver.Sequence.Factory<X, I, O>> b) { | |
| 245 |
1
1. addInputResolvers : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::addInputResolvers → KILLED |
return this.addInputResolvers(this.sourceVariableName, b); |
| 246 | } | |
| 247 | ||
| 248 | public B addInputResolvers(String variableName, Function<InputResolver.Sequence.Factory.Builder<X, I, O>, InputResolver.Sequence.Factory<X, I, O>> b) { | |
| 249 | InputResolver.Sequence.Factory.Builder<X, I, O> ib = new InputResolver.Sequence.Factory.Builder<>(this.inputVariableName, variableName); | |
| 250 |
1
1. addInputResolvers : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::addInputResolvers → KILLED |
return this.inputResolverSequenceFactory(b.apply(ib)); |
| 251 | } | |
| 252 | ||
| 253 | @SuppressWarnings("unchecked") | |
| 254 | public B addInputResolver(Function<Object, String> formatter, Function<X, I> f) { | |
| 255 | requireNonNull(formatter); | |
| 256 | requireNonNull(f); | |
| 257 |
1
1. addInputResolver : negated conditional → KILLED |
if (this.inputResolverSequenceFactoryProvider == null) { |
| 258 | this.inputResolverSequenceFactoryProvider = new InputResolverSequenceFactoryProvider<X, I, O>(this) { | |
| 259 | int count = 0; | |
| 260 | Consumer<InputResolver.Sequence.Factory.Builder<X, I, O>> inputResolverAdder = b -> { | |
| 261 | }; | |
| 262 | ||
| 263 | @Override | |
| 264 | void add(Function<Object, String> formatter, Function<X, I> f) { | |
| 265 | inputResolverAdder = inputResolverAdder.andThen(b -> b.function(formatter, f)); | |
| 266 |
1
1. add : Replaced integer addition with subtraction → SURVIVED |
count++; |
| 267 | } | |
| 268 | ||
| 269 | @Override | |
| 270 | int count() { | |
| 271 |
1
1. count : replaced int return with 0 for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase$2::count → SURVIVED |
return count; |
| 272 | } | |
| 273 | ||
| 274 | @Override | |
| 275 | public InputResolver.Sequence.Factory<X, I, O> get() { | |
| 276 | InputResolver.Sequence.Factory.Builder<X, I, O> b = new InputResolver.Sequence.Factory.Builder<>(BuilderBase.this.inputVariableName, BuilderBase.this.sourceVariableName); | |
| 277 |
1
1. get : removed call to java/util/function/Consumer::accept → KILLED |
this.inputResolverAdder.accept(b); |
| 278 |
1
1. get : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase$2::get → KILLED |
return b.build(); |
| 279 | } | |
| 280 | }; | |
| 281 | } | |
| 282 |
1
1. addInputResolver : removed call to com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase$InputResolverSequenceFactoryProvider::add → KILLED |
this.inputResolverSequenceFactoryProvider.add(formatter, f); |
| 283 |
1
1. addInputResolver : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::addInputResolver → KILLED |
return (B) this; |
| 284 | } | |
| 285 | ||
| 286 | public abstract <BB extends BuilderBase<BB, XX, I, O, R>, XX> BB sourceValueType(XX sourceType); | |
| 287 | ||
| 288 | /** | |
| 289 | * Let this object know the source type. | |
| 290 | * | |
| 291 | * @param sourceType The type of the source value.x | |
| 292 | * @param <BB> The type of this object. | |
| 293 | * @param <XX> The type of the input value. | |
| 294 | * @return This object | |
| 295 | */ | |
| 296 | @SuppressWarnings("unused") | |
| 297 | public <BB extends BuilderBase<BB, XX, I, O, R>, XX> BB sourceValueType(Class<XX> sourceType) { | |
| 298 |
1
1. sourceValueType : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::sourceValueType → KILLED |
return this.sourceValueType((XX) null); |
| 299 | } | |
| 300 | ||
| 301 | /** | |
| 302 | * Let this factory know that the source value and the input values are the same type. | |
| 303 | * | |
| 304 | * @param <BB> The type of this builder. | |
| 305 | * @return This object | |
| 306 | */ | |
| 307 | @SuppressWarnings("unchecked") | |
| 308 | public <BB extends BuilderBase<BB, I, I, O, R>> BB makeInputResolversEndomorphic() { | |
| 309 |
1
1. makeInputResolversEndomorphic : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::makeInputResolversEndomorphic → KILLED |
return (BB) this.sourceValueType((I) null) |
| 310 |
1
1. lambda$makeInputResolversEndomorphic$0 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::lambda$makeInputResolversEndomorphic$0 → SURVIVED |
.addInputResolver(x -> String.format("%s", x), Function.identity()); |
| 311 | } | |
| 312 | ||
| 313 | ||
| 314 | /** | |
| 315 | * Specifies a function under test. | |
| 316 | * | |
| 317 | * @param fut A function under test | |
| 318 | * @return This builder object | |
| 319 | */ | |
| 320 | @SuppressWarnings("unchecked") | |
| 321 | public B fut(Function<I, O> fut) { | |
| 322 | this.fut = requireNonNull(fut); | |
| 323 |
1
1. fut : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::fut → KILLED |
return (B) this; |
| 324 | } | |
| 325 | ||
| 326 | public <P> MetamorphicTestCaseFactoryWithPreformer.Builder<X, I, O, P, R> withPreformer() { | |
| 327 |
1
1. withPreformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::withPreformer → KILLED |
return this.newBuilderWithSpecifiedRelationType(MetamorphicTestCaseFactoryWithPreformer.Builder::new); |
| 328 | } | |
| 329 | ||
| 330 | public Builder<X, I, O, R> skipPreformer() { | |
| 331 |
1
1. skipPreformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::skipPreformer → NO_COVERAGE |
return this.newBuilderWithSpecifiedRelationType(Builder::new); |
| 332 | } | |
| 333 | ||
| 334 | public abstract <P> MetamorphicTestCaseFactoryWithPreformer.Builder<X, I, O, P, R> preformer(Function<IoPair<I, O>, P> preformer); | |
| 335 | ||
| 336 | public <P> MetamorphicTestCaseFactoryWithPreformer.Builder<X, I, O, P, R> preformer(String preformerName, Function<IoPair<I, O>, P> preformer) { | |
| 337 |
1
1. preformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::preformer → KILLED |
return this.preformer(Printables.function(preformerName, preformer)); |
| 338 | } | |
| 339 | ||
| 340 | public MetamorphicTestCaseFactoryWithPreformer.Builder<X, I, O, O, R> outputOnly() { | |
| 341 |
1
1. outputOnly : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::outputOnly → KILLED |
return this.preformer("outputOnly", IoPair::output); |
| 342 | } | |
| 343 | ||
| 344 | @SuppressWarnings("unchecked") | |
| 345 | public B checker(Predicate<R> checker) { | |
| 346 | this.checker = requireNonNull(checker); | |
| 347 |
1
1. checker : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::checker → KILLED |
return (B) this; |
| 348 | } | |
| 349 | ||
| 350 | public MetamorphicTestCaseFactory<X, I, O, R> check(String name, Predicate<R> checker) { | |
| 351 |
1
1. check : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::check → NO_COVERAGE |
return this.check(Printables.predicate(name, checker)); |
| 352 | } | |
| 353 | ||
| 354 | public MetamorphicTestCaseFactory<X, I, O, R> check(Predicate<R> checker) { | |
| 355 |
1
1. check : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$BuilderBase::check → KILLED |
return checker(checker).build(); |
| 356 | } | |
| 357 | ||
| 358 | public abstract MetamorphicTestCaseFactory<X, I, O, R> build(); | |
| 359 | } | |
| 360 | ||
| 361 | class Builder<X, I, O, R> extends BuilderBase<Builder<X, I, O, R>, X, I, O, R> { | |
| 362 | private Function<Dataset<IoPair<I, O>>, R> transformer; | |
| 363 | ||
| 364 | public Builder() { | |
| 365 | } | |
| 366 | ||
| 367 | @SuppressWarnings("unchecked") | |
| 368 | @Override | |
| 369 | public <BB extends BuilderBase<BB, XX, I, O, R>, XX> BB sourceValueType(XX sourceType) { | |
| 370 |
1
1. sourceValueType : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::sourceValueType → KILLED |
return (BB) this.<Builder<XX, I, O, R>, XX>newBuilderWithSpecifiedSourceType(Builder::new); |
| 371 | } | |
| 372 | ||
| 373 | public Builder<X, I, O, Proposition> propositionFactory(Function<Dataset<IoPair<I, O>>, Proposition> pf) { | |
| 374 |
1
1. propositionFactory : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::propositionFactory → KILLED |
return this.<Builder<X, I, O, Proposition>, Proposition>newBuilderWithSpecifiedRelationType(Builder::new) |
| 375 | .transformer(pf) | |
| 376 | .checker(PropositionPredicate.INSTANCE); | |
| 377 | } | |
| 378 | ||
| 379 | public MetamorphicTestCaseFactory<X, I, O, Proposition> proposition(Function<Object[], String> formatter, Predicate<Dataset<IoPair<I, O>>> p) { | |
| 380 |
1
1. proposition : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::proposition → KILLED |
return this.propositionFactory( |
| 381 | Proposition.Factory.create( | |
| 382 | p, | |
| 383 | formatter, | |
| 384 |
1
1. lambda$proposition$0 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::lambda$proposition$0 → SURVIVED |
i -> ioVariableName + "[" + i + "]", |
| 385 | inputResolverSequenceFactoryProvider.count())) | |
| 386 | .build(); | |
| 387 | } | |
| 388 | ||
| 389 | public MetamorphicTestCaseFactory<X, I, O, Proposition> proposition(String propositionName, Predicate<Dataset<IoPair<I, O>>> p) { | |
| 390 |
2
1. lambda$proposition$1 : replaced return value with "" for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::lambda$proposition$1 → SURVIVED 2. proposition : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::proposition → KILLED |
return this.proposition(args -> MessageFormat.format(propositionName, args), p); |
| 391 | } | |
| 392 | ||
| 393 | public <P> MetamorphicTestCaseFactoryWithPreformer.Builder<X, I, O, P, R> preformer(Function<IoPair<I, O>, P> preformer) { | |
| 394 |
1
1. preformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::preformer → KILLED |
return this.<P>withPreformer().preformer(preformer); |
| 395 | } | |
| 396 | ||
| 397 | public Builder<X, I, O, R> transformer(Function<Dataset<IoPair<I, O>>, R> transformer) { | |
| 398 | this.transformer = requireNonNull(transformer); | |
| 399 |
1
1. transformer : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::transformer → KILLED |
return this; |
| 400 | } | |
| 401 | ||
| 402 | @Override | |
| 403 | public MetamorphicTestCaseFactory<X, I, O, R> build() { | |
| 404 |
1
1. build : replaced return value with null for com/github/valid8j/metamor/MetamorphicTestCaseFactory$Builder::build → KILLED |
return new Impl<>(this.fut, this.inputResolverSequenceFactoryProvider.get(), this.transformer, this.checker, this.inputVariableName, this.ioVariableName); |
| 405 | } | |
| 406 | } | |
| 407 | } | |
Mutations | ||
| 35 |
1.1 |
|
| 44 |
1.1 |
|
| 63 |
1.1 2.2 |
|
| 67 |
1.1 |
|
| 68 |
1.1 |
|
| 69 |
1.1 |
|
| 70 |
1.1 |
|
| 73 |
1.1 |
|
| 83 |
1.1 |
|
| 90 |
1.1 |
|
| 94 |
1.1 |
|
| 117 |
1.1 |
|
| 122 |
1.1 |
|
| 127 |
1.1 |
|
| 132 |
1.1 |
|
| 137 |
1.1 |
|
| 142 |
1.1 |
|
| 176 |
1.1 |
|
| 185 |
1.1 |
|
| 190 |
1.1 |
|
| 196 |
1.1 |
|
| 202 |
1.1 |
|
| 208 |
1.1 |
|
| 214 |
1.1 |
|
| 220 |
1.1 |
|
| 224 |
1.1 2.2 |
|
| 225 |
1.1 |
|
| 229 |
1.1 |
|
| 239 |
1.1 |
|
| 245 |
1.1 |
|
| 250 |
1.1 |
|
| 257 |
1.1 |
|
| 266 |
1.1 |
|
| 271 |
1.1 |
|
| 277 |
1.1 |
|
| 278 |
1.1 |
|
| 282 |
1.1 |
|
| 283 |
1.1 |
|
| 298 |
1.1 |
|
| 309 |
1.1 |
|
| 310 |
1.1 |
|
| 323 |
1.1 |
|
| 327 |
1.1 |
|
| 331 |
1.1 |
|
| 337 |
1.1 |
|
| 341 |
1.1 |
|
| 347 |
1.1 |
|
| 351 |
1.1 |
|
| 355 |
1.1 |
|
| 370 |
1.1 |
|
| 374 |
1.1 |
|
| 380 |
1.1 |
|
| 384 |
1.1 |
|
| 390 |
1.1 2.2 |
|
| 394 |
1.1 |
|
| 399 |
1.1 |
|
| 404 |
1.1 |