1
|
|
package com.github.valid8j.pcond.core.fluent.builtins; |
2
|
|
|
3
|
|
import com.github.valid8j.pcond.core.fluent.AbstractObjectTransformer; |
4
|
|
import com.github.valid8j.pcond.forms.Functions; |
5
|
|
import com.github.valid8j.pcond.forms.Printables; |
6
|
|
import com.github.valid8j.pcond.internals.InternalUtils; |
7
|
|
|
8
|
|
import java.util.function.Function; |
9
|
|
import java.util.function.Supplier; |
10
|
|
|
11
|
|
import static java.util.Arrays.asList; |
12
|
|
import static java.util.Objects.requireNonNull; |
13
|
|
|
14
|
|
public interface StringTransformer<T> extends |
15
|
|
AbstractObjectTransformer< |
16
|
|
StringTransformer<T>, |
17
|
|
StringChecker<T>, |
18
|
|
T, |
19
|
|
String> { |
20
|
|
static StringTransformer<String> create(Supplier<String> value) { |
21
|
1
1. create : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::create → KILLED
|
return new Impl<>(value, InternalUtils.trivialIdentityFunction()); |
22
|
|
} |
23
|
|
|
24
|
|
default StringTransformer<T> substring(int begin) { |
25
|
3
1. lambda$substring$0 : replaced return value with "" for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$substring$0 → SURVIVED
2. lambda$substring$1 : replaced return value with "" for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$substring$1 → NO_COVERAGE
3. substring : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::substring → KILLED
|
return this.toString(Printables.function(() -> "substring[" + begin + "]", (String s) -> s.substring(begin))); |
26
|
|
} |
27
|
|
|
28
|
|
default StringTransformer<T> toUpperCase() { |
29
|
1
1. toUpperCase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::toUpperCase → KILLED
|
return this.toString(Printables.function("toUpperCase", String::toUpperCase)); |
30
|
|
} |
31
|
|
|
32
|
|
default StringTransformer<T> toLowerCase() { |
33
|
1
1. toLowerCase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::toLowerCase → KILLED
|
return this.toString(Printables.function("toLowerCase", String::toLowerCase)); |
34
|
|
} |
35
|
|
|
36
|
|
default ListTransformer<T, String> split(String regex) { |
37
|
2
1. lambda$split$2 : replaced return value with Collections.emptyList for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$split$2 → NO_COVERAGE
2. split : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::split → KILLED
|
return this.toList(Printables.function("split[" + regex + "]", (String s) -> asList((s.split(regex))))); |
38
|
|
} |
39
|
|
|
40
|
|
default IntegerTransformer<T> length() { |
41
|
1
1. length : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::length → KILLED
|
return toInteger(Functions.length()); |
42
|
|
} |
43
|
|
|
44
|
|
default BooleanTransformer<T> parseBoolean() { |
45
|
1
1. parseBoolean : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseBoolean → KILLED
|
return toBoolean(Printables.function("parseBoolean", Boolean::parseBoolean)); |
46
|
|
} |
47
|
|
|
48
|
|
default IntegerTransformer<T> parseInt() { |
49
|
1
1. parseInt : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseInt → KILLED
|
return toInteger(Printables.function("parseInt", Integer::parseInt)); |
50
|
|
} |
51
|
|
|
52
|
|
default LongTransformer<T> parseLong() { |
53
|
1
1. parseLong : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseLong → KILLED
|
return toLong(Printables.function("parseLong", Long::parseLong)); |
54
|
|
} |
55
|
|
|
56
|
|
default ShortTransformer<T> parseShort() { |
57
|
1
1. parseShort : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseShort → KILLED
|
return toShort(Printables.function("parseBoolean", Short::parseShort)); |
58
|
|
} |
59
|
|
|
60
|
|
default DoubleTransformer<T> parseDouble() { |
61
|
1
1. parseDouble : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseDouble → KILLED
|
return toDouble(Printables.function("parseDouble", Double::parseDouble)); |
62
|
|
} |
63
|
|
|
64
|
|
default FloatTransformer<T> parseFloat() { |
65
|
1
1. parseFloat : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseFloat → KILLED
|
return toFloat(Printables.function("parseFloat", Float::parseFloat)); |
66
|
|
} |
67
|
|
|
68
|
|
default StringTransformer<T> substringAfter(String token) { |
69
|
3
1. lambda$substringAfter$3 : Replaced integer addition with subtraction → SURVIVED
2. lambda$substringAfter$3 : replaced return value with "" for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$substringAfter$3 → SURVIVED
3. substringAfter : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::substringAfter → KILLED
|
return toString(Printables.function("substringAfter[" + token + "]", str -> str.substring(str.indexOf(token) + token.length()))); |
70
|
|
} |
71
|
|
|
72
|
|
class Impl<T> extends |
73
|
|
Base< |
74
|
|
StringTransformer<T>, |
75
|
|
StringChecker<T>, |
76
|
|
T, |
77
|
|
String> implements |
78
|
|
StringTransformer<T> { |
79
|
|
|
80
|
|
public Impl(Supplier<T> rootValue, Function<T, String> transformFunction) { |
81
|
|
super(rootValue, transformFunction); |
82
|
|
} |
83
|
|
|
84
|
|
@Override |
85
|
|
public StringChecker<T> toChecker(Function<T, String> transformFunction) { |
86
|
1
1. toChecker : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer$Impl::toChecker → KILLED
|
return new StringChecker.Impl<>(this::baseValue, requireNonNull(transformFunction)); |
87
|
|
} |
88
|
|
|
89
|
|
@Override |
90
|
|
public StringTransformer<String> rebase() { |
91
|
1
1. rebase : replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer$Impl::rebase → KILLED
|
return new Impl<>(this::value, InternalUtils.trivialIdentityFunction()); |
92
|
|
} |
93
|
|
} |
94
|
|
} |
| | Mutations |
21 |
|
1.1 Location : create Killed by : com.github.valid8j.ut.styles.FluentStyleDbCTest$ForEnsuresTest.test_postcondition(com.github.valid8j.ut.styles.FluentStyleDbCTest$ForEnsuresTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::create → KILLED
|
25 |
|
1.1 Location : lambda$substring$0 Killed by : none replaced return value with "" for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$substring$0 → SURVIVED 2.2 Location : lambda$substring$1 Killed by : none replaced return value with "" for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$substring$1 → NO_COVERAGE 3.3 Location : substring Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::substring → KILLED
|
29 |
|
1.1 Location : toUpperCase Killed by : com.github.valid8j.ut.styles.MoreFluentStringTest.test_contains(com.github.valid8j.ut.styles.MoreFluentStringTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::toUpperCase → KILLED
|
33 |
|
1.1 Location : toLowerCase Killed by : com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.assumeThatTest_passed(com.github.valid8j.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::toLowerCase → KILLED
|
37 |
|
1.1 Location : lambda$split$2 Killed by : none replaced return value with Collections.emptyList for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$split$2 → NO_COVERAGE 2.2 Location : split Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::split → KILLED
|
41 |
|
1.1 Location : length Killed by : com.github.valid8j.examples.test.ExamplesTest.testFluentExample(com.github.valid8j.examples.test.ExamplesTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::length → KILLED
|
45 |
|
1.1 Location : parseBoolean Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseBoolean → KILLED
|
49 |
|
1.1 Location : parseInt Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseInt → KILLED
|
53 |
|
1.1 Location : parseLong Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseLong → KILLED
|
57 |
|
1.1 Location : parseShort Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseShort → KILLED
|
61 |
|
1.1 Location : parseDouble Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseDouble → KILLED
|
65 |
|
1.1 Location : parseFloat Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::parseFloat → KILLED
|
69 |
|
1.1 Location : lambda$substringAfter$3 Killed by : none Replaced integer addition with subtraction → SURVIVED 2.2 Location : lambda$substringAfter$3 Killed by : none replaced return value with "" for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::lambda$substringAfter$3 → SURVIVED 3.3 Location : substringAfter Killed by : com.github.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[4: Given::When::Then:greaterThanOrEqualTo(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThanOrEqualTo(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.valid8j.ut.styles.fluent.GeneralFluentTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer::substringAfter → KILLED
|
86 |
|
1.1 Location : toChecker Killed by : com.github.valid8j.ut.styles.FluentStyleDbCTest$ForEnsuresTest.test_postcondition(com.github.valid8j.ut.styles.FluentStyleDbCTest$ForEnsuresTest) replaced return value with null for com/github/valid8j/pcond/core/fluent/builtins/StringTransformer$Impl::toChecker → KILLED
|
91 |
|
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/pcond/core/fluent/builtins/StringTransformer$Impl::rebase → KILLED
|