| 1 | package com.github.valid8j.pcond.core.fluent.builtins; | |
| 2 | ||
| 3 | import com.github.valid8j.pcond.core.fluent.AbstractObjectChecker; | |
| 4 | import com.github.valid8j.pcond.experimentals.cursor.Cursors; | |
| 5 | import com.github.valid8j.pcond.forms.Predicates; | |
| 6 | import com.github.valid8j.pcond.core.printable.ExplainablePredicate; | |
| 7 | import com.github.valid8j.pcond.internals.InternalUtils; | |
| 8 | ||
| 9 | import java.util.function.Function; | |
| 10 | import java.util.function.Predicate; | |
| 11 | import java.util.function.Supplier; | |
| 12 | import java.util.regex.Pattern; | |
| 13 | ||
| 14 | public interface StringChecker<T> extends | |
| 15 | AbstractObjectChecker< | |
| 16 | StringChecker<T>, | |
| 17 | T, | |
| 18 | String> { | |
| 19 | /** | |
| 20 | * Checks if the given token is contained by the target value. | |
| 21 | * @param token A token to be contained by the target value. | |
| 22 | * @return This object. | |
| 23 | */ | |
| 24 | default StringChecker<T> containing(String token) { | |
| 25 |
1
1. containing : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::containing → KILLED |
return this.checkWithPredicate(Predicates.containsString(token)); |
| 26 | } | |
| 27 | ||
| 28 | /** | |
| 29 | * Checks if given regular expressions are contained by the target value in the given order. | |
| 30 | * | |
| 31 | * @param regexes Regular expression patterns to be contained by the target value. | |
| 32 | * @return This object. | |
| 33 | */ | |
| 34 | default StringChecker<T> containingRegexes(String... regexes) { | |
| 35 |
1
1. containingRegexes : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::containingRegexes → KILLED |
return this.checkWithPredicate(Cursors.findRegexes(regexes)); |
| 36 | } | |
| 37 | ||
| 38 | /** | |
| 39 | * Checks if given tokens are contained by the target value in the given order. | |
| 40 | * | |
| 41 | * @param patterns Regular expression patterns to be contained by the target value. | |
| 42 | * @return This object. | |
| 43 | */ | |
| 44 | default StringChecker<T> containingRegexes(Pattern... patterns) { | |
| 45 |
1
1. containingRegexes : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::containingRegexes → KILLED |
return this.checkWithPredicate(Cursors.findRegexPatterns(patterns)); |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 | * Checks if given tokens are contained by the target value in the given order. | |
| 50 | * | |
| 51 | * @param tokens Tokens to be contained by the target value. | |
| 52 | * @return This object. | |
| 53 | */ | |
| 54 | default StringChecker<T> containingSubstrings(String... tokens) { | |
| 55 |
1
1. containingSubstrings : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::containingSubstrings → KILLED |
return this.checkWithPredicate(Cursors.findSubstrings(tokens)); |
| 56 | } | |
| 57 | ||
| 58 | default StringChecker<T> startingWith(String prefix) { | |
| 59 |
1
1. startingWith : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::startingWith → KILLED |
return this.checkWithPredicate(Predicates.startsWith(prefix)); |
| 60 | } | |
| 61 | ||
| 62 | default StringChecker<T> endingWith(String prefix) { | |
| 63 |
1
1. endingWith : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::endingWith → KILLED |
return this.checkWithPredicate(Predicates.endsWith(prefix)); |
| 64 | } | |
| 65 | ||
| 66 | default StringChecker<T> empty() { | |
| 67 |
1
1. empty : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::empty → KILLED |
return this.checkWithPredicate(Predicates.isEmptyString()); |
| 68 | } | |
| 69 | ||
| 70 | default StringChecker<T> notEmpty() { | |
| 71 |
1
1. notEmpty : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::notEmpty → NO_COVERAGE |
return this.checkWithPredicate(Predicates.isEmptyString().negate()); |
| 72 | } | |
| 73 | ||
| 74 | default StringChecker<T> equalTo(String string) { | |
| 75 |
1
1. equalTo : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::equalTo → KILLED |
return this.checkWithPredicate(ExplainablePredicate.explainableStringIsEqualTo(string)); |
| 76 | } | |
| 77 | ||
| 78 | default StringChecker<T> nullOrEmpty() { | |
| 79 |
1
1. nullOrEmpty : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::nullOrEmpty → KILLED |
return this.checkWithPredicate(Predicates.isNullOrEmptyString()); |
| 80 | } | |
| 81 | ||
| 82 | default StringChecker<T> matchingRegex(String regex) { | |
| 83 |
1
1. matchingRegex : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::matchingRegex → KILLED |
return this.checkWithPredicate(Predicates.matchesRegex(regex)); |
| 84 | } | |
| 85 | ||
| 86 | default StringChecker<T> equalToIgnoringCase(String s) { | |
| 87 |
1
1. equalToIgnoringCase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::equalToIgnoringCase → KILLED |
return this.checkWithPredicate(Predicates.equalsIgnoreCase(s)); |
| 88 | } | |
| 89 | ||
| 90 | @SuppressWarnings("unchecked") | |
| 91 | default StringChecker<T> check(Function<StringChecker<String>, Predicate<String>> phrase) { | |
| 92 |
2
1. check : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::check → NO_COVERAGE 2. lambda$check$0 : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker::lambda$check$0 → NO_COVERAGE |
return this.addCheckPhrase(v -> phrase.apply((StringChecker<String>) v)); |
| 93 | } | |
| 94 | ||
| 95 | class Impl<T> | |
| 96 | extends | |
| 97 | Base<StringChecker<T>, T, String> | |
| 98 | implements | |
| 99 | StringChecker<T> { | |
| 100 | protected Impl(Supplier<T> rootValue, Function<T, String> transformFunction) { | |
| 101 | super(rootValue, transformFunction); | |
| 102 | } | |
| 103 | ||
| 104 | @Override | |
| 105 | public StringChecker<String> rebase() { | |
| 106 |
1
1. rebase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringChecker$Impl::rebase → SURVIVED |
return new Impl<>(this::value, InternalUtils.trivialIdentityFunction()); |
| 107 | } | |
| 108 | } | |
| 109 | } | |
Mutations | ||
| 25 |
1.1 |
|
| 35 |
1.1 |
|
| 45 |
1.1 |
|
| 55 |
1.1 |
|
| 59 |
1.1 |
|
| 63 |
1.1 |
|
| 67 |
1.1 |
|
| 71 |
1.1 |
|
| 75 |
1.1 |
|
| 79 |
1.1 |
|
| 83 |
1.1 |
|
| 87 |
1.1 |
|
| 92 |
1.1 2.2 |
|
| 106 |
1.1 |