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