Expectations.java

1
package com.github.valid8j.fluent;
2
3
import com.github.valid8j.classic.Assertions;
4
import com.github.valid8j.classic.TestAssertions;
5
import com.github.valid8j.fluent.internals.ValidationFluents;
6
import com.github.valid8j.pcond.core.fluent.AbstractObjectTransformer;
7
import com.github.valid8j.pcond.core.fluent.Checker;
8
import com.github.valid8j.pcond.core.fluent.Matcher;
9
import com.github.valid8j.pcond.core.fluent.Transformer;
10
import com.github.valid8j.pcond.core.fluent.builtins.*;
11
import com.github.valid8j.pcond.core.refl.Parameter;
12
import com.github.valid8j.pcond.fluent.ListHolder;
13
import com.github.valid8j.pcond.fluent.Statement;
14
import com.github.valid8j.pcond.forms.Functions;
15
import com.github.valid8j.pcond.internals.InternalException;
16
import com.github.valid8j.pcond.validator.Validator;
17
18
import java.lang.reflect.InvocationTargetException;
19
import java.util.Arrays;
20
import java.util.List;
21
import java.util.Objects;
22
import java.util.function.Function;
23
import java.util.function.Predicate;
24
import java.util.function.Supplier;
25
import java.util.stream.Stream;
26
27
import static com.github.valid8j.pcond.fluent.Statement.*;
28
import static com.github.valid8j.pcond.internals.InternalUtils.trivialIdentityFunction;
29
import static java.util.Objects.requireNonNull;
30
import static java.util.stream.Collectors.toList;
31
32
/**
33
 * //@formatter:off
34
 * A facade class for the "fluent" style programming model of `valid8j` library.
35
 *
36
 * Following is an example for "overhead-less precondition checking for DbC style programming".
37
 *
38
 * [source,java]
39
 * ----
40
 * public class DbC {
41
 *   public void aMethod(int a) {
42
 *     assert Expectations.precondition(Expectations.that(a).satisfies().greaterThan(0).lessThan(100));
43
 *   }
44
 * }
45
 * ----
46
 *
47
 * Then, do `static import` to improve readability.
48
 *
49
 * [source,java]
50
 * ----
51
 * public class DbC {
52
 *   public void aMethod(int a) {
53
 *     assert precondition(that(a).satisfies().greaterThan(0).lessThan(0));
54
 *   }
55
 * }
56
 * ----
57
 *
58
 * Static methods in this class are designed so that the readability will become the best when they are static imported.
59
 *
60
 * An example for a test assertion looks like following.
61
 *
62
 * [source,java]
63
 * ----
64
 * public class TestClass {
65
 *   @Test
66
 *   public void aTestMethod() {
67
 *     assertStatement(that(a).satisfies().isGreaterThan(0).isLessThan(100));
68
 *   }
69
 * }
70
 * ----
71
 *
72
 * Also, note that `that` methods and `value` methods are synonyms to each others.
73
 * Use one which maximizes your code's readability.
74
 *
75
 * //@formatter:on
76
 */
77
@SuppressWarnings("GrazieInspection")
78
public enum Expectations {
79
  ;
80
81
  /**
82
   * Checks if all the given `statements` are satisfied.
83
   *
84
   * Otherwise, this method throws an exception whose message describes what happened (how expectations are not satisfied.)
85
   * This method is supposed to be used with `assert` statement of Java and when:
86
   *
87
   * - yor are checking invariant conditions in DbC ("Design by Contract") approach.
88
   * - you are not interested in DbC approach.
89
   *
90
   * @param statements Statements to be asserted.
91
   * @return `true` if all the statements are satisfied.
92
   */
93
  public static boolean all(Statement<?>... statements) {
94 2 1. all : replaced boolean return with true for com/github/valid8j/fluent/Expectations::all → SURVIVED
2. all : replaced boolean return with false for com/github/valid8j/fluent/Expectations::all → KILLED
    return ValidationFluents.all(statements);
95
  }
96
97
  /**
98
   * A "singular" version of {@link Expectations#all(Statement[])}.
99
   *
100
   * Prefer this method if you only have one statement to be asserted.
101
   * This method is supposed to be used with `assert` statement of Java and when:
102
   *
103
   * - yor are checking invariant conditions in DbC ("Design by Contract") approach.
104
   * - you are not interested in DbC approach.
105
   *
106
   * @param statements to be evaluated by `assert` statement of Java.
107
   * @return `true` if all the given statements are satisfied.
108
   * @see Expectations#all(Statement[])
109
   */
110
  public static boolean $(Statement<?>... statements) {
111 2 1. $ : replaced boolean return with true for com/github/valid8j/fluent/Expectations::$ → SURVIVED
2. $ : replaced boolean return with false for com/github/valid8j/fluent/Expectations::$ → KILLED
    return all(statements);
112
  }
113
114
  /**
115
   * Checks if all the given `statements` are satisfied.
116
   *
117
   * Otherwise, this method throws an exception whose message describes what happened (how expectations are not satisfied.)
118
   * This method is supposed to be used with `assert` statement of Java and when yor are checking preconditions in DbC ("Design by Contract") approach.
119
   *
120
   * @param statements Statements to be asserted.
121
   * @return `true` if all the statements are satisfied.
122
   */
123
  public static boolean preconditions(Statement<?>... statements) {
124 2 1. preconditions : replaced boolean return with false for com/github/valid8j/fluent/Expectations::preconditions → SURVIVED
2. preconditions : replaced boolean return with true for com/github/valid8j/fluent/Expectations::preconditions → SURVIVED
    return ValidationFluents.preconditions(statements);
125
  }
126
127
  /**
128
   * A "singular" version of {@link Expectations#preconditions(Statement[])}.
129
   *
130
   * Use this method if you only have one statement to be asserted.
131
   * This method is supposed to be used with `assert` statement of Java and when yor are checking a precondition in DbC ("Design by Contract") approach.
132
   *
133
   * @param statement to be evaluated by `assert` statement of Java.
134
   * @return `true` if all the given statements are satisfied.
135
   * @see Expectations#preconditions(Statement[])
136
   */
137
  public static boolean precondition(Statement<?> statement) {
138 2 1. precondition : replaced boolean return with false for com/github/valid8j/fluent/Expectations::precondition → SURVIVED
2. precondition : replaced boolean return with true for com/github/valid8j/fluent/Expectations::precondition → SURVIVED
    return ValidationFluents.precondition(statement);
139
  }
140
141
  /**
142
   * Checks if all the given `statements` are satisfied.
143
   *
144
   * Otherwise, this method throws an exception whose message describes what happened (how expectations are not satisfied.)
145
   * This method is supposed to be used with `assert` statement of Java and when yor are checking preconditions in DbC ("Design by Contract") approach.
146
   *
147
   * @param statements Statements to be asserted.
148
   * @return `true` if all the statements are satisfied.
149
   */
150
  public static boolean invariants(Statement<?>... statements) {
151 2 1. invariants : replaced boolean return with false for com/github/valid8j/fluent/Expectations::invariants → SURVIVED
2. invariants : replaced boolean return with true for com/github/valid8j/fluent/Expectations::invariants → SURVIVED
    return ValidationFluents.all(statements);
152
  }
153
154
  /**
155
   * A singular version of {@link Expectations#preconditions(Statement[])}.
156
   *
157
   * Use this method if you only have one statement to be asserted.
158
   * This method is supposed to be used with `assert` statement of Java and when yor are checking a precondition in DbC ("Design by Contract") approach.
159
   *
160
   * @param statement to be evaluated by `assert` statement of Java.
161
   * @return `true` if all the given statements are satisfied.
162
   * @see Expectations#invariants(Statement[])
163
   */
164
  public static boolean invariant(Statement<?> statement) {
165 2 1. invariant : replaced boolean return with false for com/github/valid8j/fluent/Expectations::invariant → SURVIVED
2. invariant : replaced boolean return with true for com/github/valid8j/fluent/Expectations::invariant → SURVIVED
    return ValidationFluents.that(statement);
166
  }
167
168
  /**
169
   * Checks if all the given `statements` are satisfied.
170
   *
171
   * Otherwise, this method throws an exception whose message describes what happened (how expectations are not satisfied.)
172
   * This method is supposed to be used with `assert` statement of Java and when yor are checking post-conditions in DbC ("Design by Contract") approach.
173
   *
174
   * @param statements Statements to be asserted.
175
   * @return `true` if all the statements are satisfied.
176
   */
177
  public static boolean postconditions(Statement<?>... statements) {
178
    List<?> values = Arrays.stream(statements).map(Statement::statementValue).collect(toList());
179 2 1. postconditions : replaced boolean return with false for com/github/valid8j/fluent/Expectations::postconditions → SURVIVED
2. postconditions : replaced boolean return with true for com/github/valid8j/fluent/Expectations::postconditions → SURVIVED
    return Assertions.postcondition(values, createPredicateForAllOf(statements));
180
  }
181
182
  /**
183
   * A singular version of {@link Expectations#postconditions(Statement[])}.
184
   *
185
   * Use this method if you only have one statement to be asserted.
186
   * This method is supposed to be used with `assert` statement of Java and when yor are checking a post-condition in DbC ("Design by Contract") approach.
187
   *
188
   * @param statement to be evaluated by `assert` statement of Java.
189
   * @return `true` if all the given statements are satisfied.
190
   * @see Expectations#postconditions(Statement[])
191
   */
192
  public static boolean postcondition(Statement<?> statement) {
193 2 1. postcondition : replaced boolean return with false for com/github/valid8j/fluent/Expectations::postcondition → SURVIVED
2. postcondition : replaced boolean return with true for com/github/valid8j/fluent/Expectations::postcondition → SURVIVED
    return all(statement);
194
  }
195
196
  /**
197
   * A method to check the given `statements` as preconditions.
198
   *
199
   * @param statements Preconditions to be checked.
200
   */
201
  public static void require(Statement<?>... statements) {
202 1 1. require : removed call to com/github/valid8j/fluent/internals/ValidationFluents::requireAll → SURVIVED
    ValidationFluents.requireAll(statements);
203
  }
204
205
  /**
206
   * A singular version of {@link Expectations#require(Statement[])}.
207
   *
208
   * @param statement A precondition to be checked.
209
   */
210
  public static <T> T require(Statement<T> statement) {
211 1 1. require : replaced return value with null for com/github/valid8j/fluent/Expectations::require → SURVIVED
    return ValidationFluents.requireStatement(statement);
212
  }
213
214
  /**
215
   * //@formatter:off
216
   * A method to validate a value held by the given statement.
217
   * If the value satisfies a predicate of the statement, it will be returned.
218
   * Otherwise, an exception created by `otherwise` will be thrown.
219
   *
220
   * [source, java]
221
   * ----
222
   * public class ExpectExample {
223
   *   public void method(String givenName, String familyName) {
224
   *     var firstName = expect(that(givenName).satisfies().notNull(), MyException::new);
225
   *     // ...
226
   *   }
227
   * }
228
   * ----
229
   *
230
   * This method doesn't have a plural version.
231
   * Use {@link Expectations#fail( Function)} method, instead.
232
   *
233
   * //@formatter:on
234
   *
235
   * @param statement A statement to be validated.
236
   * @return The target value held by `statement`.
237
   * @param <T> A type of value to be validated.
238
   * @see Statement
239
   * @see Expectations#fail(Function)
240
   */
241
  @SuppressWarnings("GrazieInspection")
242
  public static <T> T expect(Statement<T> statement, Function<String, Throwable> otherwise) {
243
    Objects.requireNonNull(statement);
244
    Objects.requireNonNull(otherwise);
245 1 1. expect : replaced return value with null for com/github/valid8j/fluent/Expectations::expect → SURVIVED
    return fail(otherwise).unless(statement);
246
  }
247
248
  /**
249
   * //@formatter:off
250
   * This method is useful to specify an exception class to be thrown on a failure.
251
   *
252
   * [source, java]
253
   * ----
254
   * public class FailUnless {
255
   *   public void method(int i, String message) {
256
   *     fail(MyException::new).unless(
257
   *       that(i).satisfies().greaterThan(0),
258
   *       that(message).satisfies().notNull());
259
   *     // or
260
   *     String price = fail(MyException::new).unless(that(i).lessThan(1_000_000));
261
   *   }
262
   * }
263
   * ----
264
   *
265
   * //@formatter:on
266
   * @param fail A function that creates an exception from a given error message.
267
   * @return An instance of `{@link Unless} interface.
268
   */
269
  public static Unless fail(Function<String, Throwable> fail) {
270
    Objects.requireNonNull(fail);
271 1 1. fail : replaced return value with null for com/github/valid8j/fluent/Expectations::fail → KILLED
    return new Unless() {
272
      @Override
273
      public <T> T unless(Statement<T> statement) {
274 1 1. unless : replaced return value with null for com/github/valid8j/fluent/Expectations$1::unless → SURVIVED
        return Validator.instance().validate(statement.statementValue(), statement.statementPredicate(), fail);
275
      }
276
    };
277
  }
278
279
  /**
280
   * A method to check the given `statements` as invariant conditions.
281
   *
282
   * @param statements Invariant conditions.
283
   */
284
  public static void hold(Statement<?>... statements) {
285
    ValidationFluents.all(statements);
286
  }
287
288
  /**
289
   * A singular version of {@link Expectations#hold(Statement[])}.
290
   *
291
   * @param statement An invariant condition.
292
   */
293
  public static <T> T hold(Statement<T> statement) {
294
    ValidationFluents.all(statement);
295 1 1. hold : replaced return value with null for com/github/valid8j/fluent/Expectations::hold → SURVIVED
    return statement.statementValue();
296
  }
297
298
  /**
299
   * A method to check the given `statements` as post-conditions.
300
   *
301
   * @param statements post-conditions.
302
   */
303
  public static void ensure(Statement<?>... statements) {
304 1 1. ensure : removed call to com/github/valid8j/fluent/internals/ValidationFluents::ensureAll → SURVIVED
    ValidationFluents.ensureAll(statements);
305
  }
306
307
  /**
308
   * A singular version of {@link Expectations#ensure(Statement[])}.
309
   *
310
   * @param statement A post-condition.
311
   */
312
  public static <T> T ensure(Statement<T> statement) {
313 1 1. ensure : replaced return value with null for com/github/valid8j/fluent/Expectations::ensure → SURVIVED
    return ValidationFluents.ensureStatement(statement);
314
  }
315
316
  /**
317
   * Checks if the target values of `statements` satisfy the predicates held by the `statements` as argument values.
318
   * By default, this method throws an {@link IllegalArgumentException} on a failure.
319
   *
320
   * @param statements statements to be validated.
321
   */
322
  public static void requireArguments(Statement<?>... statements) {
323 1 1. requireArguments : removed call to com/github/valid8j/fluent/internals/ValidationFluents::requireArguments → SURVIVED
    ValidationFluents.requireArguments(statements);
324
  }
325
326
  /**
327
   * Checks if the target value of `statement` satisfies the predicate held by the `statement` as an argument value.
328
   * By default, this method throws an {@link IllegalArgumentException} on a failure.
329
   *
330
   * @param statement statement to be validated.
331
   * @param <T>       The type of the target value of the `statement`.
332
   * @return The target value of `statement`.
333
   */
334
  public static <T> T requireArgument(Statement<T> statement) {
335 1 1. requireArgument : replaced return value with null for com/github/valid8j/fluent/Expectations::requireArgument → SURVIVED
    return ValidationFluents.requireArgument(statement);
336
  }
337
338
  /**
339
   * Checks if the target values of `statements` satisfy the predicates held by the `statements` as state.
340
   * By default, this method throws an {@link IllegalStateException} on a failure.
341
   *
342
   * @param statements statements to be validated.
343
   */
344
  public static void requireStates(Statement<?>... statements) {
345 1 1. requireStates : removed call to com/github/valid8j/fluent/internals/ValidationFluents::requireStates → SURVIVED
    ValidationFluents.requireStates(statements);
346
  }
347
348
  /**
349
   * Checks if the target value of `statement` satisfies the predicate held by the `statement` as a state value.
350
   * By default, this method throws an {@link IllegalStateException} on a failure.
351
   *
352
   * @param statement statement to be validated.
353
   * @param <T>       The type of the target value of the `statement`.
354
   * @return The target value of `statement`.
355
   */
356
  public static <T> T requireState(Statement<T> statement) {
357 1 1. requireState : replaced return value with null for com/github/valid8j/fluent/Expectations::requireState → SURVIVED
    return ValidationFluents.requireState(statement);
358
  }
359
360
  /**
361
   * Returns a transformer to build a statement for the given `value`.
362
   * The transformer is created by a given `transformerFunction`.
363
   * This method is called by the other `that(value)` methods and exposed as an entry-point for a user-defined custom transformer.
364
   *
365
   * @param value              A value to be validated.
366
   * @param transformerFactory A function that creates
367
   * @param <T>                The type of the value.
368
   * @param <TX>               The type of the transformer.
369
   * @param <V>                The type of the
370
   * @return A transformer used for the validation.
371
   * @see CustomTransformer
372
   */
373
  public static <T, TX extends Transformer<TX, V, T, T>, V extends Checker<V, T, T>> TX that(T value, Function<T, TX> transformerFactory) {
374 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return transformerFactory.apply(value);
375
  }
376
377
  /**
378
   * Returns a transformer to build a statement for the given `value`.
379
   *
380
   * @param value A value to be validated.
381
   * @param <T>   A type of the `value`.
382
   * @return A transformer to build a statement to validate the `value`.
383
   */
384
  public static <T> ObjectTransformer<T, T> that(T value) {
385 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::objectValue);
386
  }
387
388
  /**
389
   * Returns a transformer to build a statement for the given list `value`.
390
   *
391
   * @param value A value to be validated.
392
   * @param <T>   A type of element of the `value`.
393
   * @return A transformer to build a statement to validate the `value`.
394
   */
395
  public static <T> ListTransformer<List<T>, T> that(List<T> value) {
396 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::listValue);
397
  }
398
399
  /**
400
   * Returns a transformer to build a statement for the given stream `value`.
401
   *
402
   * @param value A value to be validated.
403
   * @param <T>   A type of element of the `value`.
404
   * @return A transformer to build a statement to validate the `value`.
405
   */
406
  public static <T> StreamTransformer<Stream<T>, T> that(Stream<T> value) {
407 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::streamValue);
408
  }
409
410
  /**
411
   * Returns a transformer to build a statement for the given string `value`.
412
   *
413
   * @param value A value to be evaluated.
414
   * @return A transformer to build a statement to validate the `value`.
415
   */
416
  public static StringTransformer<String> that(String value) {
417 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::stringValue);
418
  }
419
420
  /**
421
   * Returns a transformer to build a statement for the given integer `value`.
422
   *
423
   * @param value A value to be validated.
424
   * @return A transformer to build a statement to validate the `value`.
425
   */
426
  public static IntegerTransformer<Integer> that(int value) {
427 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::integerValue);
428
  }
429
430
  /**
431
   * Returns a transformer to build a statement for the given long `value`.
432
   *
433
   * @param value A value to be validated.
434
   * @return A transformer to build a statement to validate the `value`.
435
   */
436
  public static LongTransformer<Long> that(long value) {
437 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::longValue);
438
  }
439
440
  /**
441
   * Returns a transformer to build a statement for the given short `value`.
442
   *
443
   * @param value A value to be validated.
444
   * @return A transformer to build a statement to validate the `value`.
445
   */
446
  public static ShortTransformer<Short> that(short value) {
447 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::shortValue);
448
  }
449
450
  /**
451
   * Returns a transformer to build a statement for the given double `value`.
452
   *
453
   * @param value A value to be validated.
454
   * @return A transformer to build a statement to validate the `value`.
455
   */
456
  public static DoubleTransformer<Double> that(double value) {
457 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::doubleValue);
458
  }
459
460
  /**
461
   * Returns a transformer to build a statement for the given float `value`.
462
   *
463
   * @param value A value to be validated.
464
   * @return A transformer to build a statement to validate the `value`.
465
   */
466
  public static FloatTransformer<Float> that(float value) {
467 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::floatValue);
468
  }
469
470
  /**
471
   * Returns a transformer to build a statement for the given boolean `value`.
472
   *
473
   * @param value A value to be validated.
474
   * @return A transformer to build a statement to validate the `value`.
475
   */
476
  public static BooleanTransformer<Boolean> that(boolean value) {
477 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::booleanValue);
478
  }
479
480
  /**
481
   * Returns a transformer to build a statement for the given throwable `value`.
482
   *
483
   * @param value A value to be validated.
484
   * @return A transformer to build a statement to validate the `value`.
485
   */
486
  public static <T extends Throwable> ThrowableTransformer<T, T> that(T value) {
487 1 1. that : replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED
    return that(value, Statement::throwableValue);
488
  }
489
490
  /**
491
   * A synonym of {@link Expectations#that(Object, Function)} method.
492
   *
493
   * @param value       A value to be validated.
494
   * @param transformer A function to create a transformer for the validation.
495
   * @param <T>         The type of `value`.
496
   * @param <TX>        The type of {@link Transformer}.
497
   * @param <V>         The type of {@link Checker}.
498
   * @return A transformer used for building a statement to validate the `value`.
499
   * @see CustomTransformer
500
   * @see Expectations#that(Object, Function)
501
   */
502
  public static <T, TX extends Transformer<TX, V, T, T>, V extends Checker<V, T, T>> TX value(T value, Function<T, TX> transformer) {
503 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return that(value, transformer);
504
  }
505
506
  /**
507
   * A synonym of {@link Expectations#that(Object)}.
508
   *
509
   * @param value A value to be validated.
510
   * @param <T>   The type of `value`.
511
   * @return A transformer used for building a statement to be evaluated.
512
   * @see Expectations#that(Object)
513
   */
514
  public static <T> ObjectTransformer<T, T> value(T value) {
515 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::objectValue);
516
  }
517
518
  /**
519
   * A synonym of {@link Expectations#that(List)}.
520
   *
521
   * @param value A list to be validated.
522
   * @param <T>   The type of element in `value`.
523
   * @return A transformer used for building a statement to be evaluated.
524
   * @see Expectations#that(List)
525
   */
526
  public static <T> ListTransformer<List<T>, T> value(List<T> value) {
527 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::listValue);
528
  }
529
530
  /**
531
   * A synonym of {@link Expectations#that(Stream)}.
532
   *
533
   * @param value A stream to be validated.
534
   * @param <T>   The type of element in `value`.
535
   * @return A transformer used for building a statement to be evaluated.
536
   * @see Expectations#that(Stream)
537
   */
538
  public static <T> StreamTransformer<Stream<T>, T> value(Stream<T> value) {
539 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::streamValue);
540
  }
541
542
  /**
543
   * A synonym of {@link Expectations#that(String)}.
544
   *
545
   * @param value A string to be validated.
546
   * @return A transformer used for building a statement to be evaluated.
547
   * @see Expectations#that(String)
548
   */
549
  public static StringTransformer<String> value(String value) {
550 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::stringValue);
551
  }
552
553
  /**
554
   * A synonym of {@link Expectations#that(int)}.
555
   *
556
   * @param value A `int` to be validated.
557
   * @return A transformer used for building a statement to be evaluated.
558
   * @see Expectations#that(int)
559
   */
560
  public static IntegerTransformer<Integer> value(int value) {
561 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::integerValue);
562
  }
563
564
  /**
565
   * A synonym of {@link Expectations#that(long)}.
566
   *
567
   * @param value A `long` to be validated.
568
   * @return A transformer used for building a statement to be evaluated.
569
   * @see Expectations#that(long)
570
   */
571
  public static LongTransformer<Long> value(long value) {
572 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::longValue);
573
  }
574
575
  /**
576
   * A synonym of {@link Expectations#that(short)}.
577
   *
578
   * @param value A `short` to be validated.
579
   * @return A transformer used for building a statement to be evaluated.
580
   * @see Expectations#that(short)
581
   */
582
  public static ShortTransformer<Short> value(short value) {
583 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::shortValue);
584
  }
585
586
  /**
587
   * A synonym of {@link Expectations#that(double)}.
588
   *
589
   * @param value A `double` to be validated.
590
   * @return A transformer used for building a statement to be evaluated.
591
   * @see Expectations#that(double)
592
   */
593
  public static DoubleTransformer<Double> value(double value) {
594 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::doubleValue);
595
  }
596
597
  /**
598
   * A synonym of {@link Expectations#that(float)}.
599
   *
600
   * @param value A `float` to be validated.
601
   * @return A transformer used for building a statement to be evaluated.
602
   * @see Expectations#that(float)
603
   */
604
  public static FloatTransformer<Float> value(float value) {
605 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::floatValue);
606
  }
607
608
  /**
609
   * A synonym of {@link Expectations#that(boolean)}.
610
   *
611
   * @param value A `boolean` to be validated.
612
   * @return A transformer used for building a statement to be evaluated.
613
   * @see Expectations#that(boolean)
614
   */
615
  public static BooleanTransformer<Boolean> value(boolean value) {
616 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::booleanValue);
617
  }
618
619
  /**
620
   * A synonym of {@link Expectations#that(Throwable)}.
621
   *
622
   * @param value A `boolean` to be validated.
623
   * @return A transformer used for building a statement to be evaluated.
624
   * @see Expectations#that(boolean)
625
   */
626
  public static <E extends Throwable> ThrowableTransformer<E, E> value(E value) {
627 1 1. value : replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED
    return value(value, Statement::throwableValue);
628
  }
629
630
  /**
631
   * Returns a place holder object useful for `invokeStatic` method.
632
   *
633
   * @return A place holder object.
634
   */
635
  public static Object parameter() {
636 1 1. parameter : replaced return value with null for com/github/valid8j/fluent/Expectations::parameter → NO_COVERAGE
    return Parameter.INSTANCE;
637
  }
638
639
  /**
640
   * Returns a checker to build a statement for the given `value`.
641
   * The checker is created by the given `checkerFactory` function.
642
   *
643
   * @param value A value to be validated.
644
   * @return A checker to build a statement to validate the `value`.
645
   */
646
  public static <T, V extends Checker<V, T, T>> V satisfies(T value, Function<T, V> checkerFactory) {
647 2 1. lambda$satisfies$0 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$0 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return new LocalTransformer<>(() -> value, checkerFactory).satisfies();
648
  }
649
650
  /**
651
   * Returns a checker to build a statement for the given `value`.
652
   *
653
   * @param value A value to be validated.
654
   * @return A checker to build a statement to validate the `value`.
655
   */
656
  public static <T> ObjectChecker<T, T> satisfies(T value) {
657 2 1. lambda$satisfies$1 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$1 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> objectValue(v).satisfies());
658
  }
659
660
661
  /**
662
   * Returns a checker to build a statement for the given list `value`.
663
   *
664
   * @param value A value to be validated.
665
   * @return A checker to build a statement to validate the `value`.
666
   */
667
  public static <T> ListChecker<List<T>, T> satisfies(List<T> value) {
668 2 1. lambda$satisfies$2 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$2 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> listValue(v).satisfies());
669
  }
670
671
  /**
672
   * Returns a checker to build a statement for the given stream `value`.
673
   *
674
   * @param value A value to be validated.
675
   * @return A checker to build a statement to validate the `value`.
676
   */
677
  public static <T> StreamChecker<Stream<T>, T> satisfies(Stream<T> value) {
678 2 1. lambda$satisfies$3 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$3 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> streamValue(v).satisfies());
679
  }
680
681
  /**
682
   * Returns a checker to build a statement for the given string `value`.
683
   *
684
   * @param value A value to be validated.
685
   * @return A checker to build a statement to validate the `value`.
686
   */
687
  public static StringChecker<String> satisfies(String value) {
688 2 1. lambda$satisfies$4 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$4 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> stringValue(v).satisfies());
689
  }
690
691
  /**
692
   * Returns a checker to build a statement for the given int `value`.
693
   *
694
   * @param value A value to be validated.
695
   * @return A checker to build a statement to validate the `value`.
696
   */
697
  public static IntegerChecker<Integer> satisfies(int value) {
698 2 1. lambda$satisfies$5 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$5 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> integerValue(v).satisfies());
699
  }
700
701
  /**
702
   * Returns a checker to build a statement for the given long `value`.
703
   *
704
   * @param value A value to be validated.
705
   * @return A checker to build a statement to validate the `value`.
706
   */
707
  public static LongChecker<Long> satisfies(long value) {
708 2 1. lambda$satisfies$6 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$6 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> longValue(v).satisfies());
709
  }
710
711
  /**
712
   * Returns a checker to build a statement for the given short `value`.
713
   *
714
   * @param value A value to be validated.
715
   * @return A checker to build a statement to validate the `value`.
716
   */
717
  public static ShortChecker<Short> satisfies(short value) {
718 2 1. lambda$satisfies$7 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$7 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> shortValue(v).satisfies());
719
  }
720
721
  /**
722
   * Returns a checker to build a statement for the given double `value`.
723
   *
724
   * @param value A value to be validated.
725
   * @return A checker to build a statement to validate the `value`.
726
   */
727
  public static DoubleChecker<Double> satisfies(double value) {
728 2 1. lambda$satisfies$8 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$8 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> doubleValue(v).satisfies());
729
  }
730
731
  /**
732
   * Returns a checker to build a statement for the given float `value`.
733
   *
734
   * @param value A value to be validated.
735
   * @return A checker to build a statement to validate the `value`.
736
   */
737
  public static FloatChecker<Float> satisfies(float value) {
738 2 1. lambda$satisfies$9 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$9 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> floatValue(v).satisfies());
739
  }
740
741
  /**
742
   * Returns a checker to build a statement for the given boolean `value`.
743
   *
744
   * @param value A value to be validated.
745
   * @return A checker to build a statement to validate the `value`.
746
   */
747
  public static BooleanChecker<Boolean> satisfies(boolean value) {
748 2 1. lambda$satisfies$10 : replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$10 → KILLED
2. satisfies : replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED
    return satisfies(value, v -> booleanValue(v).satisfies());
749
  }
750
751
  /**
752
   * Returns a statement whose target is the given `value`.
753
   *
754
   * @param value A value to be validated.
755
   * @return A checker to build a statement to validate the `value`.
756
   */
757
  public static <T> Statement<T> statement(T value, Predicate<T> cond) {
758 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
759
  }
760
761
  /**
762
   * Returns a statement whose target is the given list `value`.
763
   *
764
   * @param value A value to be validated.
765
   * @return A checker to build a statement to validate the `value`.
766
   */
767
  public static <T> Statement<List<T>> statement(List<T> value, Predicate<List<T>> cond) {
768 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
769
  }
770
771
  /**
772
   * Returns a statement whose target is the given stream `value`.
773
   *
774
   * @param value A value to be validated.
775
   * @return A checker to build a statement to validate the `value`.
776
   */
777
  public static <T> Statement<Stream<T>> statement(Stream<T> value, Predicate<Stream<T>> cond) {
778 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
779
  }
780
781
  /**
782
   * Returns a statement whose target is the given string `value`.
783
   *
784
   * @param value A value to be validated.
785
   * @return A checker to build a statement to validate the `value`.
786
   */
787
  public static Statement<String> statement(String value, Predicate<String> cond) {
788 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
789
  }
790
791
  /**
792
   * Returns a statement whose target is the given int `value`.
793
   *
794
   * @param value A value to be validated.
795
   * @return A checker to build a statement to validate the `value`.
796
   */
797
  public static Statement<Integer> statement(int value, Predicate<Integer> cond) {
798 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
799
  }
800
801
  /**
802
   * Returns a statement whose target is the given long `value`.
803
   *
804
   * @param value A value to be validated.
805
   * @return A checker to build a statement to validate the `value`.
806
   */
807
  public static Statement<Long> statement(long value, Predicate<Long> cond) {
808 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
809
  }
810
811
  /**
812
   * Returns a statement whose target is the given short `value`.
813
   *
814
   * @param value A value to be validated.
815
   * @return A checker to build a statement to validate the `value`.
816
   */
817
  public static Statement<Short> statement(short value, Predicate<Short> cond) {
818 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
819
  }
820
821
  /**
822
   * Returns a statement whose target is the given double `value`.
823
   *
824
   * @param value A value to be validated.
825
   * @return A checker to build a statement to validate the `value`.
826
   */
827
  public static Statement<Double> statement(double value, Predicate<Double> cond) {
828 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
829
  }
830
831
  /**
832
   * Returns a statement whose target is the given float `value`.
833
   *
834
   * @param value A value to be validated.
835
   * @return A checker to build a statement to validate the `value`.
836
   */
837
  public static Statement<Float> statement(float value, Predicate<Float> cond) {
838 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
839
  }
840
841
  /**
842
   * Returns a statement whose target is the given boolean `value`.
843
   *
844
   * @param value A value to be validated.
845
   * @return A checker to build a statement to validate the `value`.
846
   */
847
  public static Statement<Boolean> statement(boolean value, Predicate<Boolean> cond) {
848 1 1. statement : replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED
    return satisfies(value).predicate(cond);
849
  }
850
851
  /**
852
   * Fluent version of {@link TestAssertions#assertThat(Object, Predicate)}.
853
   *
854
   * @param statement A statement to be verified
855
   * @param <T>       The type of the value to be verified which a given statement holds.
856
   */
857
  public static <T> void assertStatement(Statement<T> statement) {
858 1 1. assertStatement : removed call to com/github/valid8j/classic/TestAssertions::assertThat → KILLED
    TestAssertions.assertThat(statement.statementValue(), statement.statementPredicate());
859
  }
860
861
  /**
862
   * Fluent version of {@link TestAssertions#assertThat(Object, Predicate)}.
863
   * Use this method when you need to verify multiple values.
864
   *
865
   * You can use {@link Expectations#assertStatement(Statement)}, if you have only one statement to be verified, for readability's sake.
866
   *
867
   * @param statements Statements to be verified
868
   * @see Expectations#assertStatement(Statement)
869
   */
870
  public static void assertAll(Statement<?>... statements) {
871
    List<?> values = Arrays.stream(statements).map(Statement::statementValue).collect(toList());
872 1 1. assertAll : removed call to com/github/valid8j/classic/TestAssertions::assertThat → KILLED
    TestAssertions.assertThat(ListHolder.fromList(values), createPredicateForAllOf(statements));
873
  }
874
875
  /**
876
   * Fluent version of {@link TestAssertions#assumeThat(Object, Predicate)}.
877
   *
878
   * @param statement A statement to be verified
879
   */
880
  public static <T> void assumeStatement(Statement<T> statement) {
881 1 1. assumeStatement : removed call to com/github/valid8j/classic/TestAssertions::assumeThat → KILLED
    TestAssertions.assumeThat(statement.statementValue(), statement.statementPredicate());
882
  }
883
884
  /**
885
   * Fluent version of {@link TestAssertions#assumeThat(Object, Predicate)}.
886
   * Use this method when you need to verify multiple values.
887
   *
888
   * You can use {@link Expectations#assumeStatement(Statement)}}, if you have only one statement to be verified, for readability's sake.
889
   *
890
   * @param statements Statements to be verified
891
   * @see Expectations#assumeStatement(Statement)
892
   */
893
  public static void assumeAll(Statement<?>... statements) {
894
    List<?> values = Arrays.stream(statements).map(Statement::statementValue).collect(toList());
895 1 1. assumeAll : removed call to com/github/valid8j/classic/TestAssertions::assumeThat → KILLED
    TestAssertions.assumeThat(ListHolder.fromList(values), createPredicateForAllOf(statements));
896
  }
897
898
  /**
899
   * An interface used as a return value of {@link Expectations#fail(Function)} method.
900
   */
901
  @FunctionalInterface
902
  public interface Unless {
903
    /**
904
     * Validates a given statement and if it is valid, the target value of it will be returned.
905
     * Otherwise, an exception should be thrown.
906
     *
907
     * @param statement A statement to be validated.
908
     * @param <T>       The type of the target value of `statement`.
909
     * @return A target value of `statement`, if the `statement` is evaluated `true`.
910
     */
911
    <T> T unless(Statement<T> statement);
912
913
    /**
914
     * This doesn't return any value because it cannot be determined which value should be the one to be returned.
915
     *
916
     * @param statements Statements to be validated.
917
     */
918
    default void unless(Statement<?>... statements) {
919
      unless(statement(
920
          Arrays.stream(statements).map(Statement::statementValue).collect(toList()),
921
          createPredicateForAllOf(statements)));
922
    }
923
  }
924
925
  private static class LocalTransformer<V extends Checker<V, T, T>, T> extends AbstractObjectTransformer.Base<LocalTransformer<V, T>, V, T, T> {
926
    private final Function<T, V> checkerFactory;
927
928
    protected LocalTransformer(Supplier<T> value, Function<T, V> checkerFactory) {
929
      super(value, trivialIdentityFunction());
930
      this.checkerFactory = checkerFactory;
931
    }
932
933
    @Override
934
    protected V toChecker(Function<T, T> transformFunction) {
935 1 1. toChecker : replaced return value with null for com/github/valid8j/fluent/Expectations$LocalTransformer::toChecker → KILLED
      return checkerFactory.apply(transformFunction.apply(this.baseValue()));
936
    }
937
938
    @Override
939
    protected Matcher<?, T, T> rebase() {
940 1 1. rebase : replaced return value with null for com/github/valid8j/fluent/Expectations$LocalTransformer::rebase → NO_COVERAGE
      return new LocalTransformer<>(this::value, checkerFactory);
941
    }
942
  }
943
944
  /**
945
   * //@formatter:off
946
   * A base class for a custom transformer.
947
   *
948
   * [source,java]
949
   * .Example Transformer
950
   * ----
951
   * public static class BookTransformer extends CustomTransformer<BookTransformer, Book> {
952
   *   public BookTransformer(Book rootValue) {
953
   *     super(rootValue);
954
   *   }
955
   *
956
   *   public StringTransformer<Book> title() {
957
   *     return toString(Printables.function("title", Book::title));
958
   *   }
959
   *
960
   *   public StringTransformer<Book> abstractText() {
961
   *     return toString(Printables.function("abstractText", Book::abstractText));
962
   *   }
963
   * }
964
   * ----
965
   *
966
   * In the example above, the custom transformer class `BookTransformer`, which targets `Book` type value is specified for `TX`,
967
   * while the `Book` is specified for `T`.
968
   * //@formatter:on
969
   *
970
   * @param <TX> This class
971
   * @param <T>  Type of the class that is targeted by the transformer.
972
   */
973
  public abstract static class CustomTransformer<
974
      TX extends AbstractObjectTransformer<
975
          TX,
976
          ObjectChecker<T, T>,
977
          T,
978
          T>,
979
      T> extends
980
      Transformer.Base<
981
          TX,
982
          ObjectChecker<T, T>,
983
          T,
984
          T> implements
985
      AbstractObjectTransformer<
986
          TX,
987
          ObjectChecker<T, T>,
988
          T,
989
          T> {
990
    /**
991
     * Creates an instance of this class.
992
     *
993
     * @param baseValue The target value of this transformer.
994
     */
995
    public CustomTransformer(T baseValue) {
996 1 1. lambda$new$0 : replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::lambda$new$0 → KILLED
      super(() -> baseValue, Functions.identity());
997
    }
998
999
    /**
1000
     * {@inheritDoc}
1001
     *
1002
     * @return this object.
1003
     */
1004
    @Override
1005
    protected TX rebase() {
1006 1 1. rebase : replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::rebase → KILLED
      return create(this.value());
1007
    }
1008
1009
    @Override
1010
    protected ObjectChecker<T, T> toChecker(Function<T, T> transformFunction) {
1011 1 1. toChecker : replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::toChecker → NO_COVERAGE
      return new ObjectChecker.Impl<>(this::value, transformFunction);
1012
    }
1013
1014
    @SuppressWarnings("unchecked")
1015
    public TX transform(Function<TX, Predicate<T>> clause) {
1016
      requireNonNull(clause);
1017 2 1. lambda$transform$1 : replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::lambda$transform$1 → NO_COVERAGE
2. transform : replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::transform → NO_COVERAGE
      return this.addTransformAndCheckClause(tx -> clause.apply((TX) tx));
1018
    }
1019
1020
    @SuppressWarnings("unchecked")
1021
    protected TX create(T value) {
1022
      try {
1023 1 1. create : replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::create → KILLED
        return (TX) this.getClass().getConstructor(value.getClass()).newInstance(value);
1024
      } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
1025
        throw new InternalException(String.format("Failed to create an instance of this class: <%s>", this.getClass()), e);
1026
      }
1027
    }
1028
  }
1029
}

Mutations

94

1.1
Location : all
Killed by : com.github.valid8j.examples.test.ExamplesTest.testFluentExample(com.github.valid8j.examples.test.ExamplesTest)
replaced boolean return with false for com/github/valid8j/fluent/Expectations::all → KILLED

2.2
Location : all
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::all → SURVIVED

111

1.1
Location : $
Killed by : com.github.valid8j.examples.test.ExamplesTest.testFluentExample(com.github.valid8j.examples.test.ExamplesTest)
replaced boolean return with false for com/github/valid8j/fluent/Expectations::$ → KILLED

2.2
Location : $
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::$ → SURVIVED

124

1.1
Location : preconditions
Killed by : none
replaced boolean return with false for com/github/valid8j/fluent/Expectations::preconditions → SURVIVED

2.2
Location : preconditions
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::preconditions → SURVIVED

138

1.1
Location : precondition
Killed by : none
replaced boolean return with false for com/github/valid8j/fluent/Expectations::precondition → SURVIVED

2.2
Location : precondition
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::precondition → SURVIVED

151

1.1
Location : invariants
Killed by : none
replaced boolean return with false for com/github/valid8j/fluent/Expectations::invariants → SURVIVED

2.2
Location : invariants
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::invariants → SURVIVED

165

1.1
Location : invariant
Killed by : none
replaced boolean return with false for com/github/valid8j/fluent/Expectations::invariant → SURVIVED

2.2
Location : invariant
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::invariant → SURVIVED

179

1.1
Location : postconditions
Killed by : none
replaced boolean return with false for com/github/valid8j/fluent/Expectations::postconditions → SURVIVED

2.2
Location : postconditions
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::postconditions → SURVIVED

193

1.1
Location : postcondition
Killed by : none
replaced boolean return with false for com/github/valid8j/fluent/Expectations::postcondition → SURVIVED

2.2
Location : postcondition
Killed by : none
replaced boolean return with true for com/github/valid8j/fluent/Expectations::postcondition → SURVIVED

202

1.1
Location : require
Killed by : none
removed call to com/github/valid8j/fluent/internals/ValidationFluents::requireAll → SURVIVED

211

1.1
Location : require
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::require → SURVIVED

245

1.1
Location : expect
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::expect → SURVIVED

271

1.1
Location : fail
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[218: UNLESS: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::fail → KILLED

274

1.1
Location : unless
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations$1::unless → SURVIVED

295

1.1
Location : hold
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::hold → SURVIVED

304

1.1
Location : ensure
Killed by : none
removed call to com/github/valid8j/fluent/internals/ValidationFluents::ensureAll → SURVIVED

313

1.1
Location : ensure
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::ensure → SURVIVED

323

1.1
Location : requireArguments
Killed by : none
removed call to com/github/valid8j/fluent/internals/ValidationFluents::requireArguments → SURVIVED

335

1.1
Location : requireArgument
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::requireArgument → SURVIVED

345

1.1
Location : requireStates
Killed by : none
removed call to com/github/valid8j/fluent/internals/ValidationFluents::requireStates → SURVIVED

357

1.1
Location : requireState
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::requireState → SURVIVED

374

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[105: REQUIRE: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

385

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[108: REQUIRE: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

396

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[150: REQUIRE_STATE: LIST_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

407

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[151: REQUIRE_STATE: STREAM_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

417

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[105: REQUIRE: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

427

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[101: REQUIRE: INT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

437

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[190: ENSURE: LONG_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

447

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[34: PRECONDITION: SHORT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

457

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[214: UNLESS: DOUBLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

467

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[213: UNLESS: FLOAT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

477

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[121: REQUIRE_ARGUMENT: BOOLEAN_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

487

1.1
Location : that
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingThat[109: REQUIRE: THROWABLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::that → KILLED

503

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[196: ENSURE: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

515

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[196: ENSURE: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

527

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[227: EXPECT: LIST_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

539

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[151: REQUIRE_STATE: STREAM_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

550

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[61: INVARIANT: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

561

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[189: ENSURE: INT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

572

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[190: ENSURE: LONG_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

583

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[210: UNLESS: SHORT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

594

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[38: PRECONDITION: DOUBLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

605

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[191: ENSURE: FLOAT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

616

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[121: REQUIRE_ARGUMENT: BOOLEAN_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

627

1.1
Location : value
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingValue[197: ENSURE: THROWABLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::value → KILLED

636

1.1
Location : parameter
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations::parameter → NO_COVERAGE

647

1.1
Location : lambda$satisfies$0
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[39: PRECONDITION: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$0 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[39: PRECONDITION: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

657

1.1
Location : lambda$satisfies$1
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[42: PRECONDITION: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$1 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[42: PRECONDITION: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

668

1.1
Location : lambda$satisfies$2
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[40: PRECONDITION: LIST_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$2 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[40: PRECONDITION: LIST_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

678

1.1
Location : lambda$satisfies$3
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[41: PRECONDITION: STREAM_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$3 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[41: PRECONDITION: STREAM_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

688

1.1
Location : lambda$satisfies$4
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[39: PRECONDITION: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$4 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[39: PRECONDITION: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

698

1.1
Location : lambda$satisfies$5
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[35: PRECONDITION: INT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$5 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[35: PRECONDITION: INT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

708

1.1
Location : lambda$satisfies$6
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[36: PRECONDITION: LONG_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$6 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[36: PRECONDITION: LONG_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

718

1.1
Location : lambda$satisfies$7
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[221: EXPECT: SHORT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$7 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[221: EXPECT: SHORT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

728

1.1
Location : lambda$satisfies$8
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[214: UNLESS: DOUBLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$8 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[214: UNLESS: DOUBLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

738

1.1
Location : lambda$satisfies$9
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[37: PRECONDITION: FLOAT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$9 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[37: PRECONDITION: FLOAT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

748

1.1
Location : lambda$satisfies$10
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[99: REQUIRE: BOOLEAN_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::lambda$satisfies$10 → KILLED

2.2
Location : satisfies
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[99: REQUIRE: BOOLEAN_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::satisfies → KILLED

758

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[42: PRECONDITION: OBJECT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

768

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[40: PRECONDITION: LIST_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

778

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[41: PRECONDITION: STREAM_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

788

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[39: PRECONDITION: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

798

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[35: PRECONDITION: INT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

808

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[36: PRECONDITION: LONG_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

818

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[221: EXPECT: SHORT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

828

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[214: UNLESS: DOUBLE_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

838

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[37: PRECONDITION: FLOAT_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

848

1.1
Location : statement
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[99: REQUIRE: BOOLEAN_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations::statement → KILLED

858

1.1
Location : assertStatement
Killed by : com.github.valid8j.ut.NullValueHandlingTest.givenNull_whenStatementIsExamined_thenProcessedCorrectly(com.github.valid8j.ut.NullValueHandlingTest)
removed call to com/github/valid8j/classic/TestAssertions::assertThat → KILLED

872

1.1
Location : assertAll
Killed by : com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.multiAssertAll_failed(com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
removed call to com/github/valid8j/classic/TestAssertions::assertThat → KILLED

881

1.1
Location : assumeStatement
Killed by : com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.assumeThatTest_failed(com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
removed call to com/github/valid8j/classic/TestAssertions::assumeThat → KILLED

895

1.1
Location : assumeAll
Killed by : com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.multiAssumeAll_failed(com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
removed call to com/github/valid8j/classic/TestAssertions::assumeThat → KILLED

935

1.1
Location : toChecker
Killed by : com.github.valid8j.entrypoints.ExpectationsTest.testPassingStatement[39: PRECONDITION: STRING_STATEMENT](com.github.valid8j.entrypoints.ExpectationsTest)
replaced return value with null for com/github/valid8j/fluent/Expectations$LocalTransformer::toChecker → KILLED

940

1.1
Location : rebase
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations$LocalTransformer::rebase → NO_COVERAGE

996

1.1
Location : lambda$new$0
Killed by : com.github.valid8j.it.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.valid8j.it.SmokeTest)
replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::lambda$new$0 → KILLED

1006

1.1
Location : rebase
Killed by : com.github.valid8j.it.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.valid8j.it.SmokeTest)
replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::rebase → KILLED

1011

1.1
Location : toChecker
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::toChecker → NO_COVERAGE

1017

1.1
Location : lambda$transform$1
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::lambda$transform$1 → NO_COVERAGE

2.2
Location : transform
Killed by : none
replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::transform → NO_COVERAGE

1023

1.1
Location : create
Killed by : com.github.valid8j.it.SmokeTest.givenBook_whenCheckTitleAndAbstract_thenTheyAreNotNullAndAppropriateLength_2(com.github.valid8j.it.SmokeTest)
replaced return value with null for com/github/valid8j/fluent/Expectations$CustomTransformer::create → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3