Validator.java

1
package com.github.valid8j.pcond.validator;
2
3
import com.github.valid8j.pcond.core.*;
4
import com.github.valid8j.pcond.forms.Predicates;
5
import com.github.valid8j.pcond.internals.InternalUtils;
6
7
import java.io.IOException;
8
import java.io.InputStream;
9
import java.util.*;
10
import java.util.function.BiFunction;
11
import java.util.function.Consumer;
12
import java.util.function.Function;
13
import java.util.function.Predicate;
14
import java.util.stream.Stream;
15
16
import static com.github.valid8j.pcond.validator.Validator.Configuration.Utils.instantiate;
17
import static com.github.valid8j.pcond.validator.Validator.Configuration.Utils.loadPcondProperties;
18
import static java.lang.String.format;
19
import static java.util.Collections.emptyList;
20
21
/**
22
 * An interface of a policy for behaviours on 'contract violations'.
23
 */
24
public interface Validator {
25
  /**
26
   * A constant field that holds the default provider instance.
27
   */
28 1 1. lambda$static$0 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$static$0 → KILLED
  ThreadLocal<Validator> INSTANCE = ThreadLocal.withInitial(() -> create(loadPcondProperties()));
29
30
31
  /**
32
   * Returns a configuration object that determines behaviors of this object.
33
   *
34
   * @return A configuration object.
35
   */
36
  Configuration configuration();
37
38
  /**
39
   * Returns a provider instance created from a given `Properties` object.
40
   * This method reads the value for the FQCN of this class (`com.github.valid8j.pcond.provider.AssertionProvider`) and creates an instance of a class specified by the value.
41
   * If the value is not set, this value instantiates an object of `DefaultAssertionProvider` and returns it.
42
   *
43
   * @param properties A {@code Properties} object from which an {@code AssertionProvider} is created
44
   * @return Created provider instance.
45
   */
46
  static Validator create(Properties properties) {
47 1 1. create : replaced return value with null for com/github/valid8j/pcond/validator/Validator::create → KILLED
    return new Impl(configurationFromProperties(properties));
48
  }
49
50
  /**
51
   * Checks a value if it is {@code null} or not.
52
   * If it is not a {@code null}, this method returns the given value itself.
53
   *
54
   * @param value The given value.
55
   * @param <T>   The type of the value.
56
   * @return The {@code value}.
57
   */
58
  default <T> T requireNonNull(T value) {
59 1 1. requireNonNull : replaced return value with null for com/github/valid8j/pcond/validator/Validator::requireNonNull → KILLED
    return require(value, Predicates.isNotNull(), configuration().exceptionComposer().forRequire()::exceptionForNonNullViolation);
60
  }
61
62
  /**
63
   * Checks a value if it meets a requirement specified by {@code cond}.
64
   * If it does, the value itself will be returned.
65
   *
66
   * @param value The value to be checked.
67
   * @param cond  The requirement to check the {@code value}.
68
   * @param <T>   The type of the value.
69
   * @return The value.
70
   */
71
  default <T> T requireArgument(T value, Predicate<? super T> cond) {
72 1 1. requireArgument : replaced return value with null for com/github/valid8j/pcond/validator/Validator::requireArgument → KILLED
    return require(value, cond, configuration().exceptionComposer().forRequire()::exceptionForIllegalArgument);
73
  }
74
75
  /**
76
   * Checks a value if it meets a requirement specified by {@code cond}.
77
   * If it does, the value itself will be returned.
78
   *
79
   * @param value The value to be checked.
80
   * @param cond  The requirement to check the {@code value}.
81
   * @param <T>   The type of the value.
82
   * @return The value.
83
   */
84
  default <T> T requireState(T value, Predicate<? super T> cond) {
85 1 1. requireState : replaced return value with null for com/github/valid8j/pcond/validator/Validator::requireState → KILLED
    return require(value, cond, configuration().exceptionComposer().forRequire()::exceptionForIllegalState);
86
  }
87
88
  /**
89
   * A method to check if a given `value` satisfies a precondition given as `cond`.
90
   * If the `cond` is satisfied, the `value` itself will be returned.
91
   * Otherwise, an exception returned by `configuration().exceptionComposer().forRequire().exceptionForGeneralViolation(String)`
92
   * will be thrown.
93
   *
94
   * @param value A value to be checked.
95
   * @param cond  A condition to check if `value` satisfies.
96
   * @param <T>   The of the `value`.
97
   * @return The `value`, if `cond` is satisfied.
98
   */
99
  default <T> T require(T value, Predicate<? super T> cond) {
100 2 1. lambda$require$1 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$require$1 → KILLED
2. require : replaced return value with null for com/github/valid8j/pcond/validator/Validator::require → KILLED
    return require(value, cond, msg -> configuration().exceptionComposer().forRequire().exceptionForGeneralViolation(msg));
101
  }
102
103
  /**
104
   * A method to check if a given `value` satisfies a precondition given as `cond`.
105
   * If the `cond` is satisfied, the `value` itself will be returned.
106
   * Otherwise, an exception created by `exceptionFactory` is thrown.
107
   *
108
   * @param value            A value to be checked.
109
   * @param cond             A condition to check if `value` satisfies.
110
   * @param exceptionFactory A function to create an exception thrown when `cond`
111
   *                         is not satisfied by `value`.
112
   * @param <T>              The of the `value`.
113
   * @return The `value`, if `cond` is satisfied.
114
   */
115
  default <T> T require(T value, Predicate<? super T> cond, Function<String, Throwable> exceptionFactory) {
116 1 1. require : replaced return value with null for com/github/valid8j/pcond/validator/Validator::require → KILLED
    return checkValueAndThrowIfFails(
117
        value,
118
        cond,
119
        this.configuration().messageComposer()::composeMessageForPrecondition,
120 1 1. lambda$require$2 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$require$2 → KILLED
        explanation -> squashStackTraceElements(exceptionFactory.apply(explanation.toString())));
121
  }
122
123
  /**
124
   * Validates the given `value`.
125
   * If the value satisfies a condition `cond`, the value itself will be returned.
126
   * Otherwise, an exception created by `forValidate.exceptionForGeneralViolation()`
127
   * will be thrown.
128
   * This method is intended to be used by {@code Validates#validate(Object, Predicate, Function)}
129
   * method in `valid8j` library.
130
   *
131
   * @param value       The value to be checked.
132
   * @param cond        A condition to validate the `value`.
133
   * @param forValidate An exception composer for "validate" methods.
134
   * @param <T>         The type of the value.
135
   * @return The value itself.
136
   */
137
  default <T> T validate(T value, Predicate<? super T> cond, ExceptionComposer.ForValidate forValidate) {
138 1 1. validate : replaced return value with null for com/github/valid8j/pcond/validator/Validator::validate → NO_COVERAGE
    return validate(value, cond, forValidate::exceptionForGeneralViolation);
139
  }
140
141
  /**
142
   * Validates the given `value`.
143
   * If the value is not `null`, the value itself will be returned.
144
   * Otherwise, an exception created by `forValidate.exceptionForGeneralViolation()`
145
   * will be thrown.
146
   * This method is intended to be used by {@code Validates#validateNonNull(Object)}
147
   * method in the **valid8j** library.
148
   *
149
   * @param value       The value to be checked.
150
   * @param forValidate An exception composer for "validate" methods.
151
   * @param <T>         The type of the value.
152
   * @return The value itself.
153
   */
154
  default <T> T validateNonNull(T value, ExceptionComposer.ForValidate forValidate) {
155 1 1. validateNonNull : replaced return value with null for com/github/valid8j/pcond/validator/Validator::validateNonNull → KILLED
    return validate(value, Predicates.isNotNull(), forValidate::exceptionForNonNullViolation);
156
  }
157
158
  /**
159
   * Validates the given argument variable `value`.
160
   * If the value satisfies a condition `cond` for checking an argument variable, the value itself will be returned.
161
   * Otherwise, an exception created by `forValidate.exceptionForIllegalArgument()`
162
   * will be thrown.
163
   * This method is intended to be used by {@code Validates#validateArgument(Object, Predicate)}
164
   * method in `valid8j` library.
165
   *
166
   * @param value       The value to be checked.
167
   * @param cond        A condition to validate the `value`.
168
   * @param forValidate An exception composer for "validate" methods.
169
   * @param <T>         The type of the value.
170
   * @return The value itself.
171
   */
172
  default <T> T validateArgument(T value, Predicate<? super T> cond, ExceptionComposer.ForValidate forValidate) {
173 1 1. validateArgument : replaced return value with null for com/github/valid8j/pcond/validator/Validator::validateArgument → KILLED
    return validate(value, cond, forValidate::exceptionForIllegalArgument);
174
  }
175
176
  /**
177
   * Validates the given state variable `value`.
178
   * If the value satisfies a condition `cond` for checking a state, the value itself will be returned.
179
   * Otherwise, an exception created by `forValidate.exceptionForIllegalState()`
180
   * will be thrown.
181
   * This method is intended to be used by {@code Validates#validateState(Object, Predicate)}
182
   * method in valid8j library.
183
   *
184
   * @param value       The value to be checked.
185
   * @param cond        A condition to validate the `value`.
186
   * @param forValidate An exception composer for "validate" methods.
187
   * @param <T>         The type of the value.
188
   * @return The value itself.
189
   */
190
  default <T> T validateState(T value, Predicate<? super T> cond, ExceptionComposer.ForValidate forValidate) {
191 1 1. validateState : replaced return value with null for com/github/valid8j/pcond/validator/Validator::validateState → KILLED
    return validate(value, cond, forValidate::exceptionForIllegalState);
192
  }
193
194
  /**
195
   * Validates the given variable `value`.
196
   * If the value satisfies a condition `cond`, the value itself will be returned.
197
   * Otherwise, an exception created by `exceptionFactory` will be thrown.
198
   * This method is intended to be used by {@code Validates#validate(Object, Predicate, Function)}
199
   * method in the **valid8j** library.
200
   *
201
   * @param value            The value to be checked.
202
   * @param cond             A condition to validate the `value`.
203
   * @param exceptionFactory A function to create an exception when the `cond` is not satisfied.
204
   * @param <T>              The type of the value.
205
   * @return The value itself.
206
   */
207
  default <T> T validate(T value, Predicate<? super T> cond, Function<String, Throwable> exceptionFactory) {
208 2 1. lambda$validate$3 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$validate$3 → KILLED
2. validate : replaced return value with null for com/github/valid8j/pcond/validator/Validator::validate → KILLED
    return validate_2(value, cond, explanation -> squashStackTraceElements(exceptionFactory.apply(explanation.toString())));
209
  }
210
211
  static Throwable squashStackTraceElements(Throwable throwable) {
212
    StackTraceElement[] stackTraceElements = throwable.getStackTrace();
213
    StackTraceElement first = stackTraceElements[0];
214 1 1. squashStackTraceElements : removed call to java/lang/Throwable::setStackTrace → SURVIVED
    throwable.setStackTrace(Stream.concat(Stream.of(new StackTraceElement(first.getClassName(), "STACKTRACE_WAS_SQUASHED", first.getFileName(), first.getLineNumber())),
215
                                      Arrays.stream(stackTraceElements)
216 2 1. lambda$squashStackTraceElements$4 : negated conditional → SURVIVED
2. lambda$squashStackTraceElements$4 : replaced boolean return with true for com/github/valid8j/pcond/validator/Validator::lambda$squashStackTraceElements$4 → SURVIVED
                                            .filter(e -> !e.getClassName().startsWith("com.github.valid8j.")))
217 1 1. lambda$squashStackTraceElements$5 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$squashStackTraceElements$5 → KILLED
                                  .toArray(StackTraceElement[]::new));
218 1 1. squashStackTraceElements : replaced return value with null for com/github/valid8j/pcond/validator/Validator::squashStackTraceElements → KILLED
    return throwable;
219
  }
220
221
  default <T> T validate_2(T value, Predicate<? super T> cond, ExceptionFactory<Throwable> exceptionFactory) {
222 1 1. validate_2 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::validate_2 → KILLED
    return checkValueAndThrowIfFails(
223
        value,
224
        cond,
225
        configuration().messageComposer()::composeMessageForValidation,
226
        exceptionFactory);
227
  }
228
229
  /**
230
   * Checks a value if it is not `null`.
231
   * If it is not `null`, the value itself will be returned.
232
   * If it is, an exception created by `configuration().exceptionComposer().forEnsure().exceptionForNonNullViolation()` will be thrown.
233
   * This method is intended for ensuring a "post-condition".
234
   *
235
   * @param value The value to be checked.
236
   * @param <T>   The type of the value.
237
   * @return The value.
238
   */
239
  default <T> T ensureNonNull(T value) {
240 1 1. ensureNonNull : replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensureNonNull → KILLED
    return ensure(value, Predicates.isNotNull(), configuration().exceptionComposer().forEnsure()::exceptionForNonNullViolation);
241
  }
242
243
  /**
244
   * Checks a value if it meets a requirement specified by {@code cond}.
245
   * If it does, the value itself will be returned.
246
   * If it does not, an exception created by `configuration().exceptionComposer().forEnsure().exceptionForIllegalState()` will be thrown.
247
   * This method is intended for ensuring a "post-condition" of a state.
248
   *
249
   * @param value The value to be checked.
250
   * @param cond  The requirement to check the {@code value}.
251
   * @param <T>   The type of the value.
252
   * @return The value.
253
   */
254
  default <T> T ensureState(T value, Predicate<? super T> cond) {
255 1 1. ensureState : replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensureState → KILLED
    return ensure(value, cond, configuration().exceptionComposer().forEnsure()::exceptionForIllegalState);
256
  }
257
258
  /**
259
   * Checks a value if it meets a requirement specified by {@code cond}.
260
   * If it does, the value itself will be returned.
261
   * If it does not, an exception created by `configuration().exceptionComposer().forEnsure().exceptionForGeneralViolation()` will be thrown.
262
   * This method is intended for ensuring a "post-condition".
263
   *
264
   * @param value The value to be checked.
265
   * @param cond  The requirement to check the {@code value}.
266
   * @param <T>   The type of the value.
267
   * @return The value.
268
   */
269
  default <T> T ensure(T value, Predicate<? super T> cond) {
270 2 1. ensure : replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensure → KILLED
2. lambda$ensure$6 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$ensure$6 → KILLED
    return ensure(value, cond, msg -> configuration().exceptionComposer().forEnsure().exceptionForGeneralViolation(msg));
271
  }
272
273
  /**
274
   * Checks a value if it meets a requirement specified by {@code cond}.
275
   * If it does, the value itself will be returned.
276
   * If it does not, an exception created by `exceptionComposer` will be thrown.
277
   * This method is intended for ensuring a "post-condition".
278
   *
279
   * @param value             The value to be checked.
280
   * @param cond              The requirement to check the {@code value}.
281
   * @param exceptionComposer A function to create an exception to be thrown when
282
   *                          `cond` is not met.
283
   * @param <T>               The type of the value.
284
   * @return The value.
285
   */
286
  default <T> T ensure(T value, Predicate<? super T> cond, Function<String, Throwable> exceptionComposer) {
287 1 1. ensure : replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensure → KILLED
    return checkValueAndThrowIfFails(
288
        value,
289
        cond,
290
        configuration().messageComposer()::composeMessageForPostcondition,
291 1 1. lambda$ensure$7 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$ensure$7 → KILLED
        explanation -> squashStackTraceElements(exceptionComposer.apply(explanation.toString())));
292
  }
293
294
  /**
295
   * A method to check if a `value` satisfies a predicate `cond`.
296
   *
297
   * This method is intended to be used by {@code Assertions#that(Object, Predicate)} in valid8j library.
298
   * If the condition is not satisfied, an exception created by `this.exceptionComposer().forAssert().exceptionInvariantConditionViolation()`
299
   * method will be thrown.
300
   *
301
   * @param value A value to be checked.
302
   * @param cond  A condition to check the `value`.
303
   * @param <T>   The type of `value`.
304
   */
305
  default <T> void checkInvariant(T value, Predicate<? super T> cond) {
306
    checkValueAndThrowIfFails(
307
        value,
308
        cond,
309
        configuration().messageComposer()::composeMessageForAssertion,
310 1 1. lambda$checkInvariant$8 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$checkInvariant$8 → KILLED
        explanation -> configuration().exceptionComposer().forAssert().exceptionInvariantConditionViolation(explanation.toString()));
311
  }
312
313
  /**
314
   * A method to check if a `value` satisfies a predicate `cond`.
315
   *
316
   * This method is intended to be used by {@code Assertions#precondition(Object, Predicate)} in valid8j library.
317
   * If the condition is not satisfied, an exception created by `this.exceptionComposer().forAssert().exceptionPreconditionViolation()`
318
   * method will be thrown.
319
   *
320
   * @param value A value to be checked.
321
   * @param cond  A condition to check the `value`.
322
   * @param <T>   The type of `value`.
323
   */
324
  default <T> void checkPrecondition(T value, Predicate<? super T> cond) {
325
    checkValueAndThrowIfFails(
326
        value,
327
        cond,
328
        configuration().messageComposer()::composeMessageForPrecondition,
329 1 1. lambda$checkPrecondition$9 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$checkPrecondition$9 → KILLED
        explanation -> configuration().exceptionComposer().forAssert().exceptionPreconditionViolation(explanation.toString()));
330
  }
331
332
  /**
333
   * A method to check if a `value` satisfies a predicate `cond`.
334
   *
335
   * This method is intended to be used by {@code Assertions#postcondition(Object, Predicate)} in valid8j library.
336
   * If the condition is not satisfied, an exception created by `this.exceptionComposer().forAssert().exceptionPostconditionViolation()`
337
   * method will be thrown.
338
   *
339
   * @param value A value to be checked.
340
   * @param cond  A condition to check the `value`.
341
   * @param <T>   The type of `value`.
342
   */
343
  default <T> void checkPostcondition(T value, Predicate<? super T> cond) {
344
    checkValueAndThrowIfFails(
345
        value,
346
        cond,
347
        configuration().messageComposer()::composeMessageForPostcondition,
348 1 1. lambda$checkPostcondition$10 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$checkPostcondition$10 → KILLED
        explanation -> configuration().exceptionComposer().forAssert().exceptionPostconditionViolation(explanation.toString()));
349
  }
350
351
  /**
352
   * Executes a test assertion for a given `value` using a predicate `cond`.
353
   * If the `cond` is not satisfied by the `value`, an exception created by `configuration().messageComposer().composeMessageForAssertion()`
354
   * will be thrown.
355
   *
356
   * @param value A value to be checked.
357
   * @param cond  A predicate to check a given `value`.
358
   * @param <T>   The type of the `value`.
359
   */
360
  default <T> void assertThat(T value, Predicate<? super T> cond) {
361
    checkValueAndThrowIfFails(
362
        value,
363
        cond,
364
        configuration().messageComposer()::composeMessageForAssertion,
365 1 1. lambda$assertThat$11 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$assertThat$11 → NO_COVERAGE
        explanation -> configuration().exceptionComposer().forAssertThat().testFailedException(explanation, configuration().reportComposer()));
366
  }
367
368
  /**
369
   * Executes a test assumption check for a given `value` using a predicate `cond`.
370
   * If the `cond` is not satisfied by the `value`, an exception created by `configuration().messageComposer().composeMessageForAssertion()`
371
   * will be thrown.
372
   *
373
   * @param value A value to be checked.
374
   * @param cond  A predicate to check a given `value`.
375
   * @param <T>   The type of the `value`.
376
   */
377
  default <T> void assumeThat(T value, Predicate<? super T> cond) {
378
    checkValueAndThrowIfFails(
379
        value,
380
        cond,
381
        configuration().messageComposer()::composeMessageForAssertion,
382 1 1. lambda$assumeThat$12 : replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$assumeThat$12 → NO_COVERAGE
        explanation -> configuration().exceptionComposer().forAssertThat().testSkippedException(explanation, configuration().reportComposer()));
383
  }
384
385
  /**
386
   * The core method of the `ValueChecker`.
387
   * This method checks if the given `evaluationContext` satisfies a condition, passed as `cond`.
388
   * If it does, the `evaluationContext` itself will be returned.
389
   * If not, an appropriate message will be composed based on the `evaluationContext` and `cond` by the `messageComposerFunction`.
390
   * Internally in this method, an `Explanation` of the failure is created by a {@link ReportComposer}
391
   * object returned by `configuration().reportComposer()` method.
392
   * The `Explanation` is passed to the `exceptionComposerFunction` and the exception
393
   * created by the function will be thrown.
394
   *
395
   * @param <T>                       The type of the `evaluationContext`.
396
   * @param value                     A value to be checked.
397
   * @param cond                      A predicate that checks the `evaluationContext`.
398
   * @param messageComposerFunction   A function that composes an error message from the `evaluationContext` and the predicate `cond`.
399
   * @param exceptionComposerFunction A function that creates an exception from a failure report created inside this method.
400
   * @return The `evaluationContext` itself.
401
   */
402
  @SuppressWarnings("unchecked")
403
  default <T> T checkValueAndThrowIfFails(
404
      T value,
405
      Predicate<? super T> cond,
406
      BiFunction<T, Predicate<? super T>, String> messageComposerFunction,
407
      ExceptionFactory<Throwable> exceptionComposerFunction) {
408
    ValueHolder<T> valueHolder = ValueHolder.forValue(value);
409
    Evaluable<T> evaluable = InternalUtils.toEvaluableIfNecessary(cond);
410
    EvaluableIo<T, Evaluable<T>, Boolean> evaluableIo = new EvaluableIo<>(valueHolder, EvaluationContext.resolveEvaluationEntryType(evaluable), evaluable);
411
    EvaluationContext<T> evaluationContext = new EvaluationContext<>();
412 2 1. checkValueAndThrowIfFails : negated conditional → KILLED
2. checkValueAndThrowIfFails : negated conditional → KILLED
    if (this.configuration().useEvaluator() && cond instanceof Evaluable) {
413
      Evaluator evaluator = Evaluator.create();
414 1 1. checkValueAndThrowIfFails : removed call to com/github/valid8j/pcond/core/Evaluable::accept → KILLED
      ((Evaluable<T>) cond).accept(evaluableIo, evaluationContext, evaluator);
415 2 1. checkValueAndThrowIfFails : negated conditional → KILLED
2. checkValueAndThrowIfFails : negated conditional → KILLED
      if (evaluableIo.output().isValueReturned() && Objects.equals(true, evaluableIo.output().value()))
416 1 1. checkValueAndThrowIfFails : replaced return value with null for com/github/valid8j/pcond/validator/Validator::checkValueAndThrowIfFails → KILLED
        return value;
417
      List<EvaluationEntry> entries = evaluationContext.resultEntries();
418
      throw exceptionComposerFunction.create(configuration()
419
          .reportComposer()
420
          .composeExplanation(
421
              messageComposerFunction.apply(value, cond),
422
              entries
423
          ));
424
    } else {
425 1 1. checkValueAndThrowIfFails : negated conditional → KILLED
      if (!cond.test(valueHolder.returnedValue()))
426
        throw exceptionComposerFunction.create(configuration()
427
            .reportComposer()
428
            .composeExplanation(
429
                messageComposerFunction.apply(value, cond),
430
                emptyList()
431
            ));
432 1 1. checkValueAndThrowIfFails : replaced return value with null for com/github/valid8j/pcond/validator/Validator::checkValueAndThrowIfFails → KILLED
      return value;
433
    }
434
  }
435
436
  static Validator instance() {
437 1 1. instance : replaced return value with null for com/github/valid8j/pcond/validator/Validator::instance → KILLED
    return INSTANCE.get();
438
  }
439
440
  static void reconfigure(Consumer<Configuration.Builder> configurator) {
441
    Configuration.Builder b = instance().configuration().parentBuilder();
442 1 1. reconfigure : removed call to com/github/valid8j/pcond/validator/Validator::reconfigure → SURVIVED
    reconfigure(configurator, b);
443
  }
444
445
  static void reconfigure(Consumer<Configuration.Builder> configurator, Configuration.Builder b) {
446 1 1. reconfigure : removed call to java/util/function/Consumer::accept → SURVIVED
    Objects.requireNonNull(configurator).accept(b);
447 1 1. reconfigure : removed call to java/lang/ThreadLocal::set → SURVIVED
    INSTANCE.set(new Impl(b.build()));
448
  }
449
450
  static void resetToDefault() {
451 1 1. resetToDefault : removed call to com/github/valid8j/pcond/validator/Validator::reconfigure → SURVIVED
    reconfigure(b -> {
452
    });
453
  }
454
455
  static Configuration configurationFromProperties(Properties properties) {
456 1 1. configurationFromProperties : replaced return value with null for com/github/valid8j/pcond/validator/Validator::configurationFromProperties → KILLED
    return Configuration.Builder.fromProperties(properties).build();
457
  }
458
459
  interface ExceptionFactory<E extends Throwable> extends Function<Explanation, E> {
460
    default RuntimeException create(Explanation explanation) {
461 1 1. create : replaced return value with null for com/github/valid8j/pcond/validator/Validator$ExceptionFactory::create → NO_COVERAGE
      return createException(this, explanation);
462
    }
463
464
    static RuntimeException createException(ExceptionFactory<?> exceptionFactory, Explanation explanation) {
465
      Throwable t = squashStackTraceElements(exceptionFactory.apply(explanation));
466 1 1. createException : negated conditional → KILLED
      if (t instanceof Error)
467
        throw (Error) t;
468 1 1. createException : negated conditional → KILLED
      if (t instanceof RuntimeException)
469
        throw (RuntimeException) t;
470
      throw new AssertionError(format("Checked exception(%s) cannot be used for validation.", t.getClass()), t);
471
    }
472
  }
473
474
  interface Configuration {
475
    /**
476
     * When `com.github.valid8j.pcond.debug` is not `true`, it is assumed that those methods in this interface return `false`.
477
     */
478
    interface Debugging {
479
      default boolean suppressSquashing() {
480 1 1. suppressSquashing : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::suppressSquashing → NO_COVERAGE
        return true;
481
      }
482
483
      default boolean enableDebugLog() {
484 1 1. enableDebugLog : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::enableDebugLog → NO_COVERAGE
        return true;
485
      }
486
487
      default boolean showEvaluableDetail() {
488 1 1. showEvaluableDetail : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::showEvaluableDetail → NO_COVERAGE
        return true;
489
      }
490
491
      default boolean reportIgnoredEntries() {
492 1 1. reportIgnoredEntries : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::reportIgnoredEntries → NO_COVERAGE
        return true;
493
      }
494
495
      default boolean passThroughComparisonFailure() {
496 1 1. passThroughComparisonFailure : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::passThroughComparisonFailure → NO_COVERAGE
        return true;
497
      }
498
    }
499
500
    int summarizedStringLength();
501
502
    boolean useEvaluator();
503
504
    /**
505
     * Returns a message composer, which is responsible for composing an appropriate message for
506
     * a context.
507
     *
508
     * @return A message composer.
509
     */
510
    MessageComposer messageComposer();
511
512
    /**
513
     * Returns a report composer, which is responsible for composing an appropriate "report" for
514
     * a context.
515
     *
516
     * @return A report composer
517
     */
518
    ReportComposer reportComposer();
519
520
    /**
521
     * Returns an exception composer, which is responsible for creating an exception
522
     * object of an appropriate type for a context.
523
     *
524
     * @return An exception composer.
525
     */
526
    ExceptionComposer exceptionComposer();
527
528
    Optional<Debugging> debugging();
529
530
    Builder parentBuilder();
531
532
    enum Utils {
533
      ;
534
535
      @SuppressWarnings("unchecked")
536
      static <E> E instantiate(@SuppressWarnings("unused") Class<E> baseClass, String className) {
537
        try {
538 1 1. instantiate : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Utils::instantiate → KILLED
          return (E) Class.forName(className).newInstance();
539
        } catch (InstantiationException | IllegalAccessException |
540
                 ClassNotFoundException e) {
541
          throw new RuntimeException(e);
542
        }
543
      }
544
545
      public static Properties loadPcondProperties() {
546
        try {
547
          Properties ret = new Properties();
548 1 1. loadPcondProperties : removed call to java/util/Properties::forEach → SURVIVED
          System.getProperties().forEach((k, v) -> {
549
            String key = Objects.toString(k);
550
            String value = Objects.toString(v);
551
            String prefix = "com.github.valid8j.pcond.";
552 1 1. lambda$loadPcondProperties$0 : negated conditional → SURVIVED
            if (key.startsWith(prefix)) {
553
              ret.put(key.replace(prefix, ""), value);
554
            }
555
          });
556
          try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("pcond.properties")) {
557
            if (inputStream == null)
558 1 1. loadPcondProperties : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Utils::loadPcondProperties → KILLED
              return ret;
559 1 1. loadPcondProperties : removed call to java/util/Properties::load → NO_COVERAGE
            ret.load(inputStream);
560 1 1. loadPcondProperties : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Utils::loadPcondProperties → NO_COVERAGE
            return ret;
561
          }
562
        } catch (IOException e) {
563
          throw new RuntimeException(e);
564
        }
565
      }
566
    }
567
568
    class Builder implements Cloneable {
569
      boolean useEvaluator;
570
      int summarizedStringLength;
571
572
573
      MessageComposer messageComposer;
574
      ReportComposer reportComposer;
575
      private ExceptionComposer.ForRequire exceptionComposerForRequire;
576
      private ExceptionComposer.ForEnsure exceptionComposerForEnsure;
577
      private ExceptionComposer.ForValidate defaultExceptionComposerForValidate;
578
      private ExceptionComposer.ForAssertion exceptionComposerForAssert;
579
      private ExceptionComposer.ForTestAssertion exceptionComposerForTestFailures;
580
581
      public Builder() {
582
      }
583
584
585
      public Builder useEvaluator(boolean useEvaluator) {
586
        this.useEvaluator = useEvaluator;
587 1 1. useEvaluator : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::useEvaluator → KILLED
        return this;
588
      }
589
590
      public Builder summarizedStringLength(int summarizedStringLength) {
591
        this.summarizedStringLength = summarizedStringLength;
592 1 1. summarizedStringLength : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::summarizedStringLength → KILLED
        return this;
593
      }
594
595
      public Builder exceptionComposerForRequire(ExceptionComposer.ForRequire exceptionComposerForRequire) {
596
        this.exceptionComposerForRequire = exceptionComposerForRequire;
597 1 1. exceptionComposerForRequire : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForRequire → KILLED
        return this;
598
      }
599
600
      public Builder exceptionComposerForEnsure(ExceptionComposer.ForEnsure exceptionComposerForEnsure) {
601
        this.exceptionComposerForEnsure = exceptionComposerForEnsure;
602 1 1. exceptionComposerForEnsure : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForEnsure → KILLED
        return this;
603
      }
604
605
      public Builder defaultExceptionComposerForValidate(ExceptionComposer.ForValidate exceptionComposerForValidate) {
606
        this.defaultExceptionComposerForValidate = exceptionComposerForValidate;
607 1 1. defaultExceptionComposerForValidate : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::defaultExceptionComposerForValidate → KILLED
        return this;
608
      }
609
610
      public Builder exceptionComposerForAssert(ExceptionComposer.ForAssertion exceptionComposerForAssert) {
611
        this.exceptionComposerForAssert = exceptionComposerForAssert;
612 1 1. exceptionComposerForAssert : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForAssert → KILLED
        return this;
613
      }
614
615
      public Builder exceptionComposerForAssertThat(ExceptionComposer.ForTestAssertion exceptionComposerForAssertThat) {
616
        this.exceptionComposerForTestFailures = exceptionComposerForAssertThat;
617 1 1. exceptionComposerForAssertThat : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForAssertThat → KILLED
        return this;
618
      }
619
620
      public Builder messageComposer(MessageComposer messageComposer) {
621
        this.messageComposer = messageComposer;
622 1 1. messageComposer : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::messageComposer → KILLED
        return this;
623
      }
624
625
      public Builder reportComposer(ReportComposer reportComposer) {
626
        this.reportComposer = reportComposer;
627 1 1. reportComposer : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::reportComposer → KILLED
        return this;
628
      }
629
630
      public Builder useOpentest4J() {
631
        this.exceptionComposerForTestFailures = new ExceptionComposer.ForTestAssertion.Opentest4J();
632 1 1. useOpentest4J : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::useOpentest4J → NO_COVERAGE
        return this;
633
      }
634
635
      public Configuration build() {
636 1 1. build : negated conditional → SURVIVED
        if (!isClassPresent("org.junit.ComparisonFailure"))
637
          this.useOpentest4J();
638 1 1. build : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::build → KILLED
        return new Configuration() {
639
          private final Debugging debugging = new Debugging() {
640
          };
641
642
          private final ExceptionComposer exceptionComposer = new ExceptionComposer.Impl(
643
              exceptionComposerForRequire,
644
              exceptionComposerForEnsure,
645
              defaultExceptionComposerForValidate,
646
              exceptionComposerForAssert,
647
              exceptionComposerForTestFailures
648
          );
649
650
          @Override
651
          public int summarizedStringLength() {
652 1 1. summarizedStringLength : replaced int return with 0 for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::summarizedStringLength → KILLED
            return Builder.this.summarizedStringLength;
653
          }
654
655
          @Override
656
          public boolean useEvaluator() {
657 2 1. useEvaluator : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::useEvaluator → KILLED
2. useEvaluator : replaced boolean return with true for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::useEvaluator → KILLED
            return Builder.this.useEvaluator;
658
          }
659
660
          /**
661
           * Returns an exception composer, which is responsible for creating an exception
662
           * object of an appropriate type for a context.
663
           *
664
           * @return An exception composer.
665
           */
666
          public ExceptionComposer exceptionComposer() {
667 1 1. exceptionComposer : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::exceptionComposer → KILLED
            return this.exceptionComposer;
668
          }
669
670
          @Override
671
          public Optional<Debugging> debugging() {
672 1 1. debugging : negated conditional → KILLED
            if (Boolean.parseBoolean(System.getProperty("com.github.valid8j.pcond.debug"))) {
673 1 1. debugging : replaced return value with Optional.empty for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::debugging → NO_COVERAGE
              return Optional.of(this.debugging);
674
            }
675
            return Optional.empty();
676
          }
677
678
          @Override
679
          public MessageComposer messageComposer() {
680 1 1. messageComposer : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::messageComposer → KILLED
            return Builder.this.messageComposer;
681
          }
682
683
          @Override
684
          public ReportComposer reportComposer() {
685 1 1. reportComposer : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::reportComposer → KILLED
            return Builder.this.reportComposer;
686
          }
687
688
          @Override
689
          public Builder parentBuilder() {
690 1 1. parentBuilder : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::parentBuilder → KILLED
            return Builder.this.clone();
691
          }
692
        };
693
      }
694
695
      private static boolean isClassPresent(String s) {
696
        try {
697
          Class.forName(s);
698 1 1. isClassPresent : replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::isClassPresent → SURVIVED
          return true;
699
        } catch (ClassNotFoundException e) {
700 1 1. isClassPresent : replaced boolean return with true for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::isClassPresent → NO_COVERAGE
          return false;
701
        }
702
      }
703
704
      @Override
705
      public Builder clone() {
706
        try {
707 1 1. clone : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::clone → KILLED
          return (Builder) super.clone();
708
        } catch (CloneNotSupportedException e) {
709
          throw new AssertionError();
710
        }
711
      }
712
713
      static Builder fromProperties(Properties properties) {
714 1 1. fromProperties : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::fromProperties → KILLED
        return new Builder()
715
            .useEvaluator(Boolean.parseBoolean(properties.getProperty("useEvaluator", "true")))
716
            .summarizedStringLength(Integer.parseInt(properties.getProperty("summarizedStringLength", "40")))
717
            .exceptionComposerForRequire(instantiate(ExceptionComposer.ForRequire.class, properties.getProperty("exceptionComposerForRequire", "com.github.valid8j.pcond.validator.ExceptionComposer$ForRequire$Default")))
718
            .exceptionComposerForEnsure(instantiate(ExceptionComposer.ForEnsure.class, properties.getProperty("exceptionComposerForEnsure", "com.github.valid8j.pcond.validator.ExceptionComposer$ForEnsure$Default")))
719
            .defaultExceptionComposerForValidate(instantiate(ExceptionComposer.ForValidate.class, properties.getProperty("defaultExceptionComposerForValidate", "com.github.valid8j.pcond.validator.ExceptionComposer$ForValidate$Default")))
720
            .exceptionComposerForAssert(instantiate(ExceptionComposer.ForAssertion.class, properties.getProperty("exceptionComposerForAssert", "com.github.valid8j.pcond.validator.ExceptionComposer$ForAssertion$Default")))
721
            .exceptionComposerForAssertThat(instantiate(ExceptionComposer.ForTestAssertion.class, properties.getProperty("exceptionComposerForTestFailures", "com.github.valid8j.pcond.validator.ExceptionComposer$ForTestAssertion$JUnit4")))
722
            .messageComposer(instantiate(MessageComposer.class, properties.getProperty("messageComposer", "com.github.valid8j.pcond.validator.MessageComposer$Default")))
723
            .reportComposer(instantiate(ReportComposer.class, properties.getProperty("reportComposer", "com.github.valid8j.pcond.validator.ReportComposer$Default")));
724
      }
725
    }
726
  }
727
728
  class Impl implements Validator {
729
730
    private final Configuration configuration;
731
732
    public Impl(Configuration configuration) {
733
      this.configuration = Objects.requireNonNull(configuration);
734
    }
735
736
    @Override
737
    public Configuration configuration() {
738 1 1. configuration : replaced return value with null for com/github/valid8j/pcond/validator/Validator$Impl::configuration → KILLED
      return this.configuration;
739
    }
740
  }
741
}

Mutations

28

1.1
Location : lambda$static$0
Killed by : com.github.valid8j.entrypoints.AssertionsTest$Failing
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$static$0 → KILLED

47

1.1
Location : create
Killed by : com.github.valid8j.entrypoints.AssertionsTest$Failing
replaced return value with null for com/github/valid8j/pcond/validator/Validator::create → KILLED

59

1.1
Location : requireNonNull
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenNonNullValue_whenRequireNonNull_thenValueReturned(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::requireNonNull → KILLED

72

1.1
Location : requireArgument
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidArgument_whenRequireArgument_thenValueReturned(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::requireArgument → KILLED

85

1.1
Location : requireState
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidState_whenRequireState_thenStateReturned(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::requireState → KILLED

100

1.1
Location : lambda$require$1
Killed by : com.github.valid8j.entrypoints.RequiresTest.testRequire$thenError(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$require$1 → KILLED

2.2
Location : require
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidValue_whenRequire_thenValueReturned(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::require → KILLED

116

1.1
Location : require
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidArgument_whenRequireArgument_thenValueReturned(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::require → KILLED

120

1.1
Location : lambda$require$2
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenIllegalArgument_whenRequireArgument_thenIllegalArgumentThrown(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$require$2 → KILLED

138

1.1
Location : validate
Killed by : none
replaced return value with null for com/github/valid8j/pcond/validator/Validator::validate → NO_COVERAGE

155

1.1
Location : validateNonNull
Killed by : com.github.valid8j.entrypoints.ValidatesTest.test_validateNonNull_pass(com.github.valid8j.entrypoints.ValidatesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::validateNonNull → KILLED

173

1.1
Location : validateArgument
Killed by : com.github.valid8j.entrypoints.ValidatesTest.test_validateArgument_pass(com.github.valid8j.entrypoints.ValidatesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::validateArgument → KILLED

191

1.1
Location : validateState
Killed by : com.github.valid8j.entrypoints.ValidatesTest.test_validateState_pass(com.github.valid8j.entrypoints.ValidatesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::validateState → KILLED

208

1.1
Location : lambda$validate$3
Killed by : com.github.valid8j.entrypoints.ValidatesTest.test_validate_fail(com.github.valid8j.entrypoints.ValidatesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$validate$3 → KILLED

2.2
Location : validate
Killed by : com.github.valid8j.entrypoints.ValidatesTest.test_validateArgument_pass(com.github.valid8j.entrypoints.ValidatesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::validate → KILLED

214

1.1
Location : squashStackTraceElements
Killed by : none
removed call to java/lang/Throwable::setStackTrace → SURVIVED

216

1.1
Location : lambda$squashStackTraceElements$4
Killed by : none
negated conditional → SURVIVED

2.2
Location : lambda$squashStackTraceElements$4
Killed by : none
replaced boolean return with true for com/github/valid8j/pcond/validator/Validator::lambda$squashStackTraceElements$4 → SURVIVED

217

1.1
Location : lambda$squashStackTraceElements$5
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenIllegalArgument_whenRequireArgument_thenIllegalArgumentThrown(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$squashStackTraceElements$5 → KILLED

218

1.1
Location : squashStackTraceElements
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenIllegalArgument_whenRequireArgument_thenIllegalArgumentThrown(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::squashStackTraceElements → KILLED

222

1.1
Location : validate_2
Killed by : com.github.valid8j.entrypoints.ValidatesTest.test_validateArgument_pass(com.github.valid8j.entrypoints.ValidatesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::validate_2 → KILLED

240

1.1
Location : ensureNonNull
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenNonNullValue_whenEnsureNonNull_thenValueReturned(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensureNonNull → KILLED

255

1.1
Location : ensureState
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenValidState_whenEnsureState_thenStateReturned(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensureState → KILLED

270

1.1
Location : ensure
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenValidArgument_whenEnsure_thenValueReturned(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensure → KILLED

2.2
Location : lambda$ensure$6
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenIllegalValue_whenEnsure_thenPostconditionViolationThrown(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$ensure$6 → KILLED

287

1.1
Location : ensure
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenValidArgument_whenEnsure_thenValueReturned(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::ensure → KILLED

291

1.1
Location : lambda$ensure$7
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenIllegalValue_whenEnsure_thenPostconditionViolationThrown(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$ensure$7 → KILLED

310

1.1
Location : lambda$checkInvariant$8
Killed by : com.github.valid8j.entrypoints.AssertionsTest$Failing
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$checkInvariant$8 → KILLED

329

1.1
Location : lambda$checkPrecondition$9
Killed by : com.github.valid8j.entrypoints.AssertionsTest$Failing
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$checkPrecondition$9 → KILLED

348

1.1
Location : lambda$checkPostcondition$10
Killed by : com.github.valid8j.entrypoints.AssertionsTest$Failing
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$checkPostcondition$10 → KILLED

365

1.1
Location : lambda$assertThat$11
Killed by : none
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$assertThat$11 → NO_COVERAGE

382

1.1
Location : lambda$assumeThat$12
Killed by : none
replaced return value with null for com/github/valid8j/pcond/validator/Validator::lambda$assumeThat$12 → NO_COVERAGE

412

1.1
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.ut.valuechecker.DefaultValidatorTest.withoutEvaluator_conj_thenFail(com.github.valid8j.ut.valuechecker.DefaultValidatorTest)
negated conditional → KILLED

2.2
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenValidArgument_whenEnsure_thenValueReturned(com.github.valid8j.entrypoints.EnsuresTest)
negated conditional → KILLED

414

1.1
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidState$whenRequireState$thenPass(com.github.valid8j.entrypoints.RequiresTest)
removed call to com/github/valid8j/pcond/core/Evaluable::accept → KILLED

415

1.1
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidState$whenRequireState$thenPass(com.github.valid8j.entrypoints.RequiresTest)
negated conditional → KILLED

2.2
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidState$whenRequireState$thenPass(com.github.valid8j.entrypoints.RequiresTest)
negated conditional → KILLED

416

1.1
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidState$whenRequireState$thenPass(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::checkValueAndThrowIfFails → KILLED

425

1.1
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenValidArgument_whenEnsure_thenValueReturned(com.github.valid8j.entrypoints.EnsuresTest)
negated conditional → KILLED

432

1.1
Location : checkValueAndThrowIfFails
Killed by : com.github.valid8j.entrypoints.EnsuresTest.givenValidArgument_whenEnsure_thenValueReturned(com.github.valid8j.entrypoints.EnsuresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::checkValueAndThrowIfFails → KILLED

437

1.1
Location : instance
Killed by : com.github.valid8j.ut.internal.InternalUtilsTest$FormatObjectTest.testFormatObject$boundaryLengthString(com.github.valid8j.ut.internal.InternalUtilsTest$FormatObjectTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::instance → KILLED

442

1.1
Location : reconfigure
Killed by : none
removed call to com/github/valid8j/pcond/validator/Validator::reconfigure → SURVIVED

446

1.1
Location : reconfigure
Killed by : none
removed call to java/util/function/Consumer::accept → SURVIVED

447

1.1
Location : reconfigure
Killed by : none
removed call to java/lang/ThreadLocal::set → SURVIVED

451

1.1
Location : resetToDefault
Killed by : none
removed call to com/github/valid8j/pcond/validator/Validator::reconfigure → SURVIVED

456

1.1
Location : configurationFromProperties
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator::configurationFromProperties → KILLED

461

1.1
Location : create
Killed by : none
replaced return value with null for com/github/valid8j/pcond/validator/Validator$ExceptionFactory::create → NO_COVERAGE

466

1.1
Location : createException
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenIllegalArgument_whenRequireArgument_thenIllegalArgumentThrown(com.github.valid8j.entrypoints.RequiresTest)
negated conditional → KILLED

468

1.1
Location : createException
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenIllegalArgument_whenRequireArgument_thenIllegalArgumentThrown(com.github.valid8j.entrypoints.RequiresTest)
negated conditional → KILLED

480

1.1
Location : suppressSquashing
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::suppressSquashing → NO_COVERAGE

484

1.1
Location : enableDebugLog
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::enableDebugLog → NO_COVERAGE

488

1.1
Location : showEvaluableDetail
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::showEvaluableDetail → NO_COVERAGE

492

1.1
Location : reportIgnoredEntries
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::reportIgnoredEntries → NO_COVERAGE

496

1.1
Location : passThroughComparisonFailure
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Debugging::passThroughComparisonFailure → NO_COVERAGE

538

1.1
Location : instantiate
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Utils::instantiate → KILLED

548

1.1
Location : loadPcondProperties
Killed by : none
removed call to java/util/Properties::forEach → SURVIVED

552

1.1
Location : lambda$loadPcondProperties$0
Killed by : none
negated conditional → SURVIVED

558

1.1
Location : loadPcondProperties
Killed by : com.github.valid8j.entrypoints.AssertionsTest$Failing
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Utils::loadPcondProperties → KILLED

559

1.1
Location : loadPcondProperties
Killed by : none
removed call to java/util/Properties::load → NO_COVERAGE

560

1.1
Location : loadPcondProperties
Killed by : none
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Utils::loadPcondProperties → NO_COVERAGE

587

1.1
Location : useEvaluator
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::useEvaluator → KILLED

592

1.1
Location : summarizedStringLength
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::summarizedStringLength → KILLED

597

1.1
Location : exceptionComposerForRequire
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForRequire → KILLED

602

1.1
Location : exceptionComposerForEnsure
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForEnsure → KILLED

607

1.1
Location : defaultExceptionComposerForValidate
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::defaultExceptionComposerForValidate → KILLED

612

1.1
Location : exceptionComposerForAssert
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForAssert → KILLED

617

1.1
Location : exceptionComposerForAssertThat
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::exceptionComposerForAssertThat → KILLED

622

1.1
Location : messageComposer
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::messageComposer → KILLED

627

1.1
Location : reportComposer
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::reportComposer → KILLED

632

1.1
Location : useOpentest4J
Killed by : none
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::useOpentest4J → NO_COVERAGE

636

1.1
Location : build
Killed by : none
negated conditional → SURVIVED

638

1.1
Location : build
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::build → KILLED

652

1.1
Location : summarizedStringLength
Killed by : com.github.valid8j.ut.internal.InternalUtilsTest$FormatObjectTest.testFormatObject$boundaryLengthString(com.github.valid8j.ut.internal.InternalUtilsTest$FormatObjectTest)
replaced int return with 0 for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::summarizedStringLength → KILLED

657

1.1
Location : useEvaluator
Killed by : com.github.valid8j.ut.utilstest.ReportDetailTest.givenLongString_whenCheckEqualnessUsingCustomPredicateWithSlightlyDifferentString_thenFailWithDetailsArePrinted(com.github.valid8j.ut.utilstest.ReportDetailTest)
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::useEvaluator → KILLED

2.2
Location : useEvaluator
Killed by : com.github.valid8j.ut.valuechecker.DefaultValidatorTest.withoutEvaluator_conj_thenFail(com.github.valid8j.ut.valuechecker.DefaultValidatorTest)
replaced boolean return with true for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::useEvaluator → KILLED

667

1.1
Location : exceptionComposer
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenValidArgument_whenRequireArgument_thenValueReturned(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::exceptionComposer → KILLED

672

1.1
Location : debugging
Killed by : com.github.valid8j.ut.utilstest.PredicatesTest$MessageTest.testFormat(com.github.valid8j.ut.utilstest.PredicatesTest$MessageTest)
negated conditional → KILLED

673

1.1
Location : debugging
Killed by : none
replaced return value with Optional.empty for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::debugging → NO_COVERAGE

680

1.1
Location : messageComposer
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::messageComposer → KILLED

685

1.1
Location : reportComposer
Killed by : com.github.valid8j.entrypoints.RequiresTest.givenIllegalArgument_whenRequireArgument_thenIllegalArgumentThrown(com.github.valid8j.entrypoints.RequiresTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::reportComposer → KILLED

690

1.1
Location : parentBuilder
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder$1::parentBuilder → KILLED

698

1.1
Location : isClassPresent
Killed by : none
replaced boolean return with false for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::isClassPresent → SURVIVED

700

1.1
Location : isClassPresent
Killed by : none
replaced boolean return with true for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::isClassPresent → NO_COVERAGE

707

1.1
Location : clone
Killed by : com.github.valid8j.examples.test.ExamplesTest.testMetarmorExamplePassing(com.github.valid8j.examples.test.ExamplesTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::clone → KILLED

714

1.1
Location : fromProperties
Killed by : com.github.valid8j.entrypoints.AssertionsTest$MessageTest.composeMessage$thenComposed(com.github.valid8j.entrypoints.AssertionsTest$MessageTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Configuration$Builder::fromProperties → KILLED

738

1.1
Location : configuration
Killed by : com.github.valid8j.ut.internal.InternalUtilsTest$FormatObjectTest.testFormatObject$boundaryLengthString(com.github.valid8j.ut.internal.InternalUtilsTest$FormatObjectTest)
replaced return value with null for com/github/valid8j/pcond/validator/Validator$Impl::configuration → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3