1 | package com.github.valid8j.classic; | |
2 | ||
3 | import com.github.valid8j.pcond.fluent.Statement; | |
4 | import com.github.valid8j.pcond.validator.ExceptionComposer; | |
5 | import com.github.valid8j.pcond.validator.Validator; | |
6 | ||
7 | import java.util.function.Function; | |
8 | import java.util.function.Predicate; | |
9 | ||
10 | import static com.github.valid8j.pcond.validator.Validator.instance; | |
11 | ||
12 | public enum Validates { | |
13 | ; | |
14 | static final TestValidator VALIDATOR = createValidator(Validator.instance().configuration().exceptionComposer().defaultForValidate()); | |
15 | ||
16 | public static <T> T validate(T value, Predicate<? super T> predicate) { | |
17 |
1
1. validate : replaced return value with null for com/github/valid8j/classic/Validates::validate → KILLED |
return validate(value, predicate, IllegalValueException::new); |
18 | } | |
19 | ||
20 | public static <T, E extends RuntimeException> T validate(T value, Predicate<? super T> cond, Function<String, E> exceptionFactory) { | |
21 |
1
1. validate : replaced return value with null for com/github/valid8j/classic/Validates::validate → KILLED |
return VALIDATOR.validate(value, cond, exceptionFactory); |
22 | } | |
23 | ||
24 | public static <T> T validateNonNull(T value) { | |
25 |
1
1. validateNonNull : replaced return value with null for com/github/valid8j/classic/Validates::validateNonNull → KILLED |
return VALIDATOR.validateNonNull(value); |
26 | } | |
27 | ||
28 | public static <T> T validateArgument(T value, Predicate<? super T> cond) { | |
29 |
1
1. validateArgument : replaced return value with null for com/github/valid8j/classic/Validates::validateArgument → KILLED |
return VALIDATOR.validateArgument(value, cond); |
30 | } | |
31 | ||
32 | public static <T> T validateState(T value, Predicate<? super T> cond) { | |
33 |
1
1. validateState : replaced return value with null for com/github/valid8j/classic/Validates::validateState → KILLED |
return VALIDATOR.validateState(value, cond); |
34 | } | |
35 | ||
36 | public static TestValidator createValidator(ExceptionComposer.ForValidate exceptionComposerForValidate) { | |
37 |
1
1. createValidator : replaced return value with null for com/github/valid8j/classic/Validates::createValidator → SURVIVED |
return TestValidator.create(exceptionComposerForValidate); |
38 | } | |
39 | ||
40 | public static <T> T validateStatement(Statement<T> statement) { | |
41 |
1
1. validateStatement : replaced return value with null for com/github/valid8j/classic/Validates::validateStatement → SURVIVED |
return Validates.validate(statement.statementValue(), statement.statementPredicate(), IllegalValueException::new); |
42 | } | |
43 | ||
44 | public interface TestValidator { | |
45 | ExceptionComposer.ForValidate exceptionComposerForValidate(); | |
46 | ||
47 | default <T> T validate(T value, Predicate<? super T> cond) { | |
48 |
1
1. validate : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::validate → NO_COVERAGE |
return instance().validate(value, cond, exceptionComposerForValidate()); |
49 | } | |
50 | ||
51 | default <T, E extends RuntimeException> T validate(T value, Predicate<? super T> cond, Function<String, E> exceptionFactory) { | |
52 |
1
1. validate : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::validate → KILLED |
return instance().validate(value, cond, exceptionFactory::apply); |
53 | } | |
54 | ||
55 | default <T> T validateNonNull(T value) { | |
56 |
1
1. validateNonNull : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::validateNonNull → KILLED |
return instance().validateNonNull(value, exceptionComposerForValidate()); |
57 | } | |
58 | ||
59 | default <T> T validateArgument(T value, Predicate<? super T> cond) { | |
60 |
1
1. validateArgument : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::validateArgument → KILLED |
return instance().validateArgument(value, cond, exceptionComposerForValidate()); |
61 | } | |
62 | ||
63 | default <T> T validateState(T value, Predicate<? super T> cond) { | |
64 |
1
1. validateState : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::validateState → KILLED |
return instance().validateState(value, cond, exceptionComposerForValidate()); |
65 | } | |
66 | ||
67 | static TestValidator create(ExceptionComposer.ForValidate exceptionComposerForValidate) { | |
68 |
2
1. create : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::create → SURVIVED 2. lambda$create$0 : replaced return value with null for com/github/valid8j/classic/Validates$TestValidator::lambda$create$0 → KILLED |
return () -> exceptionComposerForValidate; |
69 | } | |
70 | } | |
71 | ||
72 | ||
73 | } | |
Mutations | ||
17 |
1.1 |
|
21 |
1.1 |
|
25 |
1.1 |
|
29 |
1.1 |
|
33 |
1.1 |
|
37 |
1.1 |
|
41 |
1.1 |
|
48 |
1.1 |
|
52 |
1.1 |
|
56 |
1.1 |
|
60 |
1.1 |
|
64 |
1.1 |
|
68 |
1.1 2.2 |