1 | package com.github.valid8j.pcond.validator; | |
2 | ||
3 | import com.github.valid8j.pcond.core.DebuggingUtils; | |
4 | import com.github.valid8j.pcond.core.EvaluationEntry; | |
5 | import com.github.valid8j.pcond.fluent.ValueHolder; | |
6 | import com.github.valid8j.pcond.internals.InternalUtils; | |
7 | ||
8 | import java.util.*; | |
9 | import java.util.concurrent.atomic.AtomicInteger; | |
10 | import java.util.concurrent.atomic.AtomicReference; | |
11 | import java.util.function.Function; | |
12 | import java.util.function.Supplier; | |
13 | ||
14 | import static java.lang.Math.max; | |
15 | import static java.lang.Math.min; | |
16 | import static java.lang.String.format; | |
17 | import static java.util.Collections.emptyList; | |
18 | import static java.util.Collections.unmodifiableList; | |
19 | import static java.util.stream.Collectors.joining; | |
20 | import static java.util.stream.Collectors.toList; | |
21 | ||
22 | public interface ReportComposer { | |
23 | default Explanation explanationFromMessage(String msg) { | |
24 |
1
1. explanationFromMessage : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer::explanationFromMessage → KILLED |
return Explanation.fromMessage(msg); |
25 | } | |
26 | ||
27 | default Explanation composeExplanation(String message, List<EvaluationEntry> evaluationEntries) { | |
28 |
1
1. composeExplanation : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer::composeExplanation → KILLED |
return Utils.composeExplanation(this, message, evaluationEntries); |
29 | } | |
30 | ||
31 | default FormattedEntry createFormattedEntryForExpectation(EvaluationEntry evaluationEntry) { | |
32 |
1
1. createFormattedEntryForExpectation : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer::createFormattedEntryForExpectation → KILLED |
return Utils.createFormattedEntryForExpectation(this, evaluationEntry); |
33 | } | |
34 | ||
35 | default FormattedEntry createFormattedEntryForActualValue(EvaluationEntry evaluationEntry) { | |
36 |
1
1. createFormattedEntryForActualValue : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer::createFormattedEntryForActualValue → KILLED |
return Utils.createFormattedEntryForActualValue(this, evaluationEntry); |
37 | } | |
38 | ||
39 | default boolean requiresExplanation(EvaluationEntry evaluationEntry) { | |
40 |
2
1. requiresExplanation : replaced boolean return with false for com/github/valid8j/pcond/validator/ReportComposer::requiresExplanation → KILLED 2. requiresExplanation : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer::requiresExplanation → KILLED |
return evaluationEntry.requiresExplanation(); |
41 | } | |
42 | ||
43 | /** | |
44 | * A default implementation of `ReportComposer`. | |
45 | */ | |
46 | class Default implements ReportComposer { | |
47 | } | |
48 | ||
49 | interface Report { | |
50 | String summary(); | |
51 | ||
52 | List<String> details(); | |
53 | ||
54 | static Report create(String summary, List<String> details) { | |
55 | List<String> detailsCopy = unmodifiableList(new ArrayList<>(details)); | |
56 |
1
1. create : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Report::create → KILLED |
return new Report() { |
57 | @Override | |
58 | public String summary() { | |
59 |
1
1. summary : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Report$1::summary → KILLED |
return summary; |
60 | } | |
61 | ||
62 | @Override | |
63 | public List<String> details() { | |
64 |
1
1. details : replaced return value with Collections.emptyList for com/github/valid8j/pcond/validator/ReportComposer$Report$1::details → KILLED |
return detailsCopy; |
65 | } | |
66 | }; | |
67 | } | |
68 | } | |
69 | ||
70 | class FormattedEntry { | |
71 | private final String input; | |
72 | private final String formName; | |
73 | private final String indent; | |
74 | private final String output; | |
75 | private final boolean requiresExplanation; | |
76 | ||
77 | public FormattedEntry(String input, String formName, String indent, String output, boolean requiresExplanation) { | |
78 | this.input = input; | |
79 | this.formName = formName; | |
80 | this.indent = indent; | |
81 | this.output = output; | |
82 | this.requiresExplanation = requiresExplanation; | |
83 | } | |
84 | ||
85 | Optional<String> input() { | |
86 |
1
1. input : replaced return value with Optional.empty for com/github/valid8j/pcond/validator/ReportComposer$FormattedEntry::input → KILLED |
return Optional.ofNullable(this.input); |
87 | } | |
88 | ||
89 | String indent() { | |
90 |
1
1. indent : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$FormattedEntry::indent → KILLED |
return this.indent; |
91 | } | |
92 | ||
93 | String formName() { | |
94 |
1
1. formName : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$FormattedEntry::formName → KILLED |
return this.formName; |
95 | } | |
96 | ||
97 | Optional<String> output() { | |
98 |
1
1. output : replaced return value with Optional.empty for com/github/valid8j/pcond/validator/ReportComposer$FormattedEntry::output → KILLED |
return Optional.ofNullable(this.output); |
99 | } | |
100 | ||
101 | public boolean requiresExplanation() { | |
102 |
2
1. requiresExplanation : replaced boolean return with false for com/github/valid8j/pcond/validator/ReportComposer$FormattedEntry::requiresExplanation → KILLED 2. requiresExplanation : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer$FormattedEntry::requiresExplanation → KILLED |
return this.requiresExplanation; |
103 | } | |
104 | } | |
105 | ||
106 | enum Utils { | |
107 | ; | |
108 | ||
109 | /** | |
110 | * Note that an exception thrown during an evaluation is normally caught by the framework. | |
111 | * | |
112 | * @param message A message to be prepended to a summary. | |
113 | * @param evaluationHistory An "evaluation history" object represented as a list of evaluation entries. | |
114 | * @return An explanation object. | |
115 | */ | |
116 | public static Explanation composeExplanation(ReportComposer reportComposer, String message, List<EvaluationEntry> evaluationHistory) { | |
117 | List<Object> detailsForExpectation = new LinkedList<>(); | |
118 | List<FormattedEntry> summaryDataForExpectations = squashTrivialEntries(reportComposer, evaluationHistory) | |
119 | .stream() | |
120 |
1
1. lambda$composeExplanation$0 : removed call to com/github/valid8j/pcond/validator/ReportComposer$Utils::addToDetailsListIfExplanationIsRequired → KILLED |
.peek((EvaluationEntry each) -> addToDetailsListIfExplanationIsRequired(reportComposer, detailsForExpectation, each, each::detailOutputExpectation)) |
121 | .map(reportComposer::createFormattedEntryForExpectation) | |
122 | .collect(toList()); | |
123 | String textSummaryForExpectations = composeSummaryForExpectations(minimizeIndentation(summaryDataForExpectations)); | |
124 | List<Object> detailsForActual = new LinkedList<>(); | |
125 | List<FormattedEntry> summaryForActual = squashTrivialEntries(reportComposer, evaluationHistory) | |
126 | .stream() | |
127 |
1
1. lambda$composeExplanation$1 : removed call to com/github/valid8j/pcond/validator/ReportComposer$Utils::addToDetailsListIfExplanationIsRequired → KILLED |
.peek((EvaluationEntry each) -> addToDetailsListIfExplanationIsRequired(reportComposer, detailsForActual, each, each::detailOutputActualValue)) |
128 | .map(reportComposer::createFormattedEntryForActualValue) | |
129 | .collect(toList()); | |
130 | String textSummaryForActualResult = composeSummaryForActualResults(minimizeIndentation(summaryForActual)); | |
131 |
1
1. composeExplanation : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::composeExplanation → KILLED |
return new Explanation(message, |
132 | composeReport(textSummaryForExpectations, detailsForExpectation), | |
133 | composeReport(textSummaryForActualResult, detailsForActual)); | |
134 | } | |
135 | ||
136 | public static FormattedEntry createFormattedEntryForExpectation(ReportComposer reportComposer, EvaluationEntry entry) { | |
137 |
1
1. createFormattedEntryForExpectation : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::createFormattedEntryForExpectation → KILLED |
return new FormattedEntry( |
138 | InternalUtils.formatObject(entry.inputExpectation()), | |
139 | entry.formName(), | |
140 | InternalUtils.indent(entry.level()), | |
141 | InternalUtils.formatObject(entry.outputExpectation()), | |
142 | reportComposer.requiresExplanation(entry)); | |
143 | } | |
144 | ||
145 | public static FormattedEntry createFormattedEntryForActualValue(ReportComposer reportComposer, EvaluationEntry entry) { | |
146 |
1
1. createFormattedEntryForActualValue : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::createFormattedEntryForActualValue → KILLED |
return new FormattedEntry( |
147 | InternalUtils.formatObject(entry.inputActualValue()), | |
148 | entry.formName(), | |
149 | InternalUtils.indent(entry.level()), | |
150 | InternalUtils.formatObject(entry.outputActualValue()), | |
151 | reportComposer.requiresExplanation(entry)); | |
152 | } | |
153 | ||
154 | private static List<FormattedEntry> minimizeIndentation(List<FormattedEntry> summaryForActual) { | |
155 | String minIndent = summaryForActual.stream() | |
156 |
1
1. lambda$minimizeIndentation$2 : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$minimizeIndentation$2 → SURVIVED |
.map(e -> e.indent) |
157 | .min(Comparator.comparingInt(String::length)) | |
158 | .orElse(""); | |
159 |
1
1. minimizeIndentation : replaced return value with Collections.emptyList for com/github/valid8j/pcond/validator/ReportComposer$Utils::minimizeIndentation → KILLED |
return summaryForActual.stream() |
160 |
1
1. lambda$minimizeIndentation$3 : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$minimizeIndentation$3 → KILLED |
.map(e -> new FormattedEntry(e.input, e.formName(), e.indent().replaceFirst(minIndent, ""), e.output, e.requiresExplanation())) |
161 | .collect(toList()); | |
162 | } | |
163 | ||
164 | private static List<EvaluationEntry> squashTrivialEntries(ReportComposer reportComposer, List<EvaluationEntry> evaluationHistory) { | |
165 |
2
1. squashTrivialEntries : changed conditional boundary → SURVIVED 2. squashTrivialEntries : negated conditional → KILLED |
if (evaluationHistory.size() > 1) { |
166 | List<EvaluationEntry> ret = new LinkedList<>(); | |
167 | List<EvaluationEntry> entriesToSquash = new LinkedList<>(); | |
168 | AtomicReference<EvaluationEntry> cur = new AtomicReference<>(); | |
169 | evaluationHistory.stream() | |
170 |
3
1. lambda$squashTrivialEntries$4 : negated conditional → KILLED 2. lambda$squashTrivialEntries$4 : negated conditional → KILLED 3. lambda$squashTrivialEntries$4 : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$4 → KILLED |
.filter(each -> !each.ignored() || DebuggingUtils.reportIgnoredEntries()) |
171 | .filter(each -> { | |
172 |
1
1. lambda$squashTrivialEntries$5 : negated conditional → KILLED |
if (cur.get() != null) |
173 |
1
1. lambda$squashTrivialEntries$5 : replaced boolean return with false for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$5 → KILLED |
return true; |
174 | else { | |
175 |
1
1. lambda$squashTrivialEntries$5 : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED |
cur.set(each); |
176 |
1
1. lambda$squashTrivialEntries$5 : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$5 → KILLED |
return false; |
177 | } | |
178 | }) | |
179 |
1
1. squashTrivialEntries : removed call to java/util/stream/Stream::forEach → KILLED |
.forEach(each -> { |
180 |
1
1. lambda$squashTrivialEntries$6 : negated conditional → KILLED |
if (entriesToSquash.isEmpty()) { |
181 |
2
1. lambda$squashTrivialEntries$6 : negated conditional → KILLED 2. lambda$squashTrivialEntries$6 : negated conditional → KILLED |
if (cur.get().isSquashable(each) && !suppressSquashing()) { |
182 | entriesToSquash.add(cur.get()); | |
183 | } else { | |
184 | ret.add(cur.get()); | |
185 | } | |
186 | } else { | |
187 | entriesToSquash.add(cur.get()); | |
188 | ret.add(squashEntries(reportComposer, entriesToSquash)); | |
189 |
1
1. lambda$squashTrivialEntries$6 : removed call to java/util/List::clear → KILLED |
entriesToSquash.clear(); |
190 | } | |
191 |
1
1. lambda$squashTrivialEntries$6 : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED |
cur.set(each); |
192 | }); | |
193 |
1
1. squashTrivialEntries : removed call to com/github/valid8j/pcond/validator/ReportComposer$Utils::finishLeftOverEntries → KILLED |
finishLeftOverEntries(reportComposer, ret, entriesToSquash, cur); |
194 |
1
1. squashTrivialEntries : replaced return value with Collections.emptyList for com/github/valid8j/pcond/validator/ReportComposer$Utils::squashTrivialEntries → KILLED |
return ret.stream() |
195 |
2
1. lambda$squashTrivialEntries$7 : negated conditional → KILLED 2. lambda$squashTrivialEntries$7 : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$7 → KILLED |
.filter(e -> !(e.inputActualValue() instanceof ValueHolder)) |
196 | .collect(toList()); | |
197 | } else { | |
198 |
1
1. squashTrivialEntries : replaced return value with Collections.emptyList for com/github/valid8j/pcond/validator/ReportComposer$Utils::squashTrivialEntries → KILLED |
return new ArrayList<>(evaluationHistory); |
199 | } | |
200 | } | |
201 | ||
202 | private static void finishLeftOverEntries(ReportComposer reportComposer, List<EvaluationEntry> out, List<EvaluationEntry> leftOverEntriesToSquash, AtomicReference<EvaluationEntry> leftOver) { | |
203 |
4
1. finishLeftOverEntries : Replaced integer subtraction with addition → KILLED 2. finishLeftOverEntries : negated conditional → KILLED 3. finishLeftOverEntries : negated conditional → KILLED 4. finishLeftOverEntries : negated conditional → KILLED |
if (!leftOverEntriesToSquash.isEmpty() && leftOverEntriesToSquash.get(leftOverEntriesToSquash.size() - 1).isSquashable(leftOver.get()) && !suppressSquashing()) { |
204 | leftOverEntriesToSquash.add(leftOver.get()); | |
205 | out.add(squashEntries(reportComposer, leftOverEntriesToSquash)); | |
206 | } else { | |
207 |
1
1. finishLeftOverEntries : negated conditional → KILLED |
if (!leftOverEntriesToSquash.isEmpty()) |
208 | out.add(squashEntries(reportComposer, leftOverEntriesToSquash)); | |
209 | out.add(leftOver.get()); | |
210 | } | |
211 | } | |
212 | ||
213 | private static EvaluationEntry squashEntries(ReportComposer reportComposer, List<EvaluationEntry> squashedItems) { | |
214 | EvaluationEntry first = squashedItems.get(0); | |
215 |
1
1. squashEntries : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::squashEntries → KILLED |
return EvaluationEntry.create( |
216 | squashedItems.stream() | |
217 |
1
1. lambda$squashEntries$8 : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$squashEntries$8 → KILLED |
.map(e -> (EvaluationEntry.Impl) e) |
218 | .map(EvaluationEntry::formName) | |
219 | .collect(joining(":")), | |
220 | first.type(), | |
221 | first.level(), | |
222 | first.inputExpectation(), first.detailInputExpectation(), | |
223 | first.outputExpectation(), computeDetailOutputExpectationFromSquashedItems(squashedItems), | |
224 | first.inputActualValue(), null, | |
225 |
1
1. squashEntries : Replaced integer subtraction with addition → KILLED |
first.outputActualValue(), squashedItems.get(squashedItems.size() - 1).detailOutputActualValue(), |
226 | false, | |
227 | squashedItems.stream().anyMatch(reportComposer::requiresExplanation), false); | |
228 | } | |
229 | ||
230 | @SuppressWarnings("BooleanMethodIsAlwaysInverted") | |
231 | private static boolean suppressSquashing() { | |
232 |
2
1. suppressSquashing : replaced boolean return with false for com/github/valid8j/pcond/validator/ReportComposer$Utils::suppressSquashing → SURVIVED 2. suppressSquashing : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer$Utils::suppressSquashing → KILLED |
return DebuggingUtils.suppressSquashing(); |
233 | } | |
234 | ||
235 | private static String computeDetailOutputExpectationFromSquashedItems(List<EvaluationEntry> squashedItems) { | |
236 |
1
1. computeDetailOutputExpectationFromSquashedItems : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::computeDetailOutputExpectationFromSquashedItems → KILLED |
return squashedItems.stream() |
237 |
3
1. lambda$computeDetailOutputExpectationFromSquashedItems$9 : negated conditional → KILLED 2. lambda$computeDetailOutputExpectationFromSquashedItems$9 : negated conditional → KILLED 3. lambda$computeDetailOutputExpectationFromSquashedItems$9 : replaced boolean return with true for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$computeDetailOutputExpectationFromSquashedItems$9 → KILLED |
.filter(e -> e.type() != EvaluationEntry.Type.TRANSFORM && e.type() != EvaluationEntry.Type.CHECK) |
238 | .map(EvaluationEntry::detailOutputExpectation) | |
239 | .map(Objects::toString) | |
240 | .collect(joining(":")); | |
241 | } | |
242 | ||
243 | private static void addToDetailsListIfExplanationIsRequired(ReportComposer reportComposer, List<Object> detailsForExpectation, EvaluationEntry evaluationEntry, Supplier<Object> detailOutput) { | |
244 |
1
1. addToDetailsListIfExplanationIsRequired : negated conditional → KILLED |
if (reportComposer.requiresExplanation(evaluationEntry)) |
245 | detailsForExpectation.add(detailOutput.get()); | |
246 | } | |
247 | ||
248 | static Report composeReport(String summary, List<Object> details) { | |
249 |
1
1. composeReport : negated conditional → KILLED |
List<String> stringFormDetails = details != null ? |
250 | details.stream() | |
251 | .filter(Objects::nonNull) | |
252 | .map(Objects::toString) | |
253 | .collect(toList()) : | |
254 | emptyList(); | |
255 |
1
1. composeReport : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::composeReport → KILLED |
return Report.create(summary, stringFormDetails); |
256 | } | |
257 | ||
258 | private static String composeSummaryForActualResults(List<FormattedEntry> formattedEntries) { | |
259 |
1
1. composeSummaryForActualResults : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::composeSummaryForActualResults → KILLED |
return composeSummary(formattedEntries); |
260 | } | |
261 | ||
262 | private static String composeSummaryForExpectations(List<FormattedEntry> formattedEntries) { | |
263 |
1
1. composeSummaryForExpectations : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::composeSummaryForExpectations → KILLED |
return composeSummaryForActualResults(formattedEntries); |
264 | } | |
265 | ||
266 | private static String composeSummary(List<FormattedEntry> formattedEntries) { | |
267 | AtomicInteger mismatchExplanationCount = new AtomicInteger(0); | |
268 | boolean mismatchExplanationFound = formattedEntries | |
269 | .stream() | |
270 | .anyMatch(FormattedEntry::requiresExplanation); | |
271 |
1
1. composeSummary : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::composeSummary → KILLED |
return evaluatorEntriesToString( |
272 | hideInputValuesWhenRepeated(formattedEntries), | |
273 |
1
1. lambda$composeSummary$10 : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$composeSummary$10 → KILLED |
columnLengths -> formattedEntryToString( |
274 | columnLengths[0], | |
275 | columnLengths[1], | |
276 | columnLengths[2], | |
277 | mismatchExplanationCount, | |
278 | mismatchExplanationFound)); | |
279 | } | |
280 | ||
281 | private static Function<FormattedEntry, String> formattedEntryToString( | |
282 | int inputColumnWidth, | |
283 | int formNameColumnLength, | |
284 | int outputColumnLength, | |
285 | AtomicInteger i, | |
286 | boolean mismatchExplanationFound) { | |
287 |
1
1. formattedEntryToString : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::formattedEntryToString → KILLED |
return (FormattedEntry formattedEntry) -> |
288 |
2
1. lambda$formattedEntryToString$13 : negated conditional → KILLED 2. lambda$formattedEntryToString$13 : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$formattedEntryToString$13 → KILLED |
(mismatchExplanationFound ? |
289 |
1
1. lambda$formattedEntryToString$13 : negated conditional → KILLED |
format("%-4s", formattedEntry.requiresExplanation ? |
290 | "[" + i.getAndIncrement() + "]" : "") : | |
291 | "") + | |
292 |
1
1. lambda$formattedEntryToString$13 : Replaced integer addition with subtraction → SURVIVED |
String.format("%-" + max(2, inputColumnWidth) + "s" + |
293 | "%-" + (formNameColumnLength + 2) + "s" + | |
294 | "%-" + max(2, outputColumnLength) + "s", | |
295 | formattedEntry.input().orElse(""), | |
296 | formattedEntry.input() | |
297 |
1
1. lambda$null$11 : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$null$11 → KILLED |
.map(v -> "->") |
298 |
1
1. lambda$formattedEntryToString$13 : Replaced integer subtraction with addition → SURVIVED |
.orElse(" ") + InternalUtils.formatObject(InternalUtils.toNonStringObject(formattedEntry.indent() + formattedEntry.formName()), formNameColumnLength - 2), |
299 | formattedEntry | |
300 | .output() | |
301 |
1
1. lambda$null$12 : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$null$12 → KILLED |
.map(v -> "->" + v).orElse("")); |
302 | } | |
303 | ||
304 | private static String evaluatorEntriesToString(List<FormattedEntry> formattedEntries, Function<int[], Function<FormattedEntry, String>> formatterFactory) { | |
305 | int maxInputLength = 0, maxIndentAndFormNameLength = 0, maxOutputLength = 0; | |
306 | for (FormattedEntry eachEntry : formattedEntries) { | |
307 | int inputLength = eachEntry.input().map(String::length).orElse(0); | |
308 |
2
1. evaluatorEntriesToString : changed conditional boundary → SURVIVED 2. evaluatorEntriesToString : negated conditional → SURVIVED |
if (inputLength > maxInputLength) |
309 | maxInputLength = inputLength; | |
310 |
1
1. evaluatorEntriesToString : Replaced integer addition with subtraction → KILLED |
int inputAndFormNameLength = eachEntry.indent().length() + eachEntry.formName().length(); |
311 |
2
1. evaluatorEntriesToString : changed conditional boundary → SURVIVED 2. evaluatorEntriesToString : negated conditional → KILLED |
if (inputAndFormNameLength > maxIndentAndFormNameLength) |
312 | maxIndentAndFormNameLength = inputAndFormNameLength; | |
313 | int outputLength = eachEntry.output().map(String::length).orElse(0); | |
314 |
2
1. evaluatorEntriesToString : changed conditional boundary → SURVIVED 2. evaluatorEntriesToString : negated conditional → SURVIVED |
if (outputLength > maxOutputLength) |
315 | maxOutputLength = outputLength; | |
316 | } | |
317 |
2
1. evaluatorEntriesToString : Replaced integer modulus with multiplication → KILLED 2. evaluatorEntriesToString : Replaced integer addition with subtraction → KILLED |
int formNameColumnLength = (formNameColumnLength = Math.max( |
318 |
1
1. evaluatorEntriesToString : negated conditional → KILLED |
DebuggingUtils.showEvaluableDetail() ? 80 : 12, |
319 | Math.min(InternalUtils.summarizedStringLength(), maxIndentAndFormNameLength))) + formNameColumnLength % 2; | |
320 | Function<FormattedEntry, String> formatter = formatterFactory.apply( | |
321 | new int[] { maxInputLength, formNameColumnLength, maxOutputLength }); | |
322 |
1
1. evaluatorEntriesToString : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::evaluatorEntriesToString → KILLED |
return formattedEntries |
323 | .stream() | |
324 | .map(formatter) | |
325 |
1
1. lambda$evaluatorEntriesToString$14 : replaced return value with "" for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$evaluatorEntriesToString$14 → KILLED |
.map(s -> ("+" + s).trim().substring(1)) |
326 | .collect(joining(format("%n"))); | |
327 | } | |
328 | ||
329 | private static List<FormattedEntry> hideInputValuesWhenRepeated(List<FormattedEntry> formattedEntries) { | |
330 | AtomicReference<Object> previousInput = new AtomicReference<>(); | |
331 |
1
1. hideInputValuesWhenRepeated : replaced return value with Collections.emptyList for com/github/valid8j/pcond/validator/ReportComposer$Utils::hideInputValuesWhenRepeated → KILLED |
return formattedEntries.stream() |
332 | .map(each -> { | |
333 |
1
1. lambda$hideInputValuesWhenRepeated$15 : negated conditional → KILLED |
if (!Objects.equals(previousInput.get(), each.input())) { |
334 |
1
1. lambda$hideInputValuesWhenRepeated$15 : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED |
previousInput.set(each.input()); |
335 |
1
1. lambda$hideInputValuesWhenRepeated$15 : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$hideInputValuesWhenRepeated$15 → KILLED |
return each; |
336 | } else { | |
337 |
1
1. lambda$hideInputValuesWhenRepeated$15 : replaced return value with null for com/github/valid8j/pcond/validator/ReportComposer$Utils::lambda$hideInputValuesWhenRepeated$15 → KILLED |
return new FormattedEntry("", each.formName(), each.indent(), each.output().orElse(null), each.requiresExplanation()); |
338 | } | |
339 | }) | |
340 | .collect(toList()); | |
341 | } | |
342 | ||
343 | ||
344 | } | |
345 | } | |
Mutations | ||
24 |
1.1 |
|
28 |
1.1 |
|
32 |
1.1 |
|
36 |
1.1 |
|
40 |
1.1 2.2 |
|
56 |
1.1 |
|
59 |
1.1 |
|
64 |
1.1 |
|
86 |
1.1 |
|
90 |
1.1 |
|
94 |
1.1 |
|
98 |
1.1 |
|
102 |
1.1 2.2 |
|
120 |
1.1 |
|
127 |
1.1 |
|
131 |
1.1 |
|
137 |
1.1 |
|
146 |
1.1 |
|
156 |
1.1 |
|
159 |
1.1 |
|
160 |
1.1 |
|
165 |
1.1 2.2 |
|
170 |
1.1 2.2 3.3 |
|
172 |
1.1 |
|
173 |
1.1 |
|
175 |
1.1 |
|
176 |
1.1 |
|
179 |
1.1 |
|
180 |
1.1 |
|
181 |
1.1 2.2 |
|
189 |
1.1 |
|
191 |
1.1 |
|
193 |
1.1 |
|
194 |
1.1 |
|
195 |
1.1 2.2 |
|
198 |
1.1 |
|
203 |
1.1 2.2 3.3 4.4 |
|
207 |
1.1 |
|
215 |
1.1 |
|
217 |
1.1 |
|
225 |
1.1 |
|
232 |
1.1 2.2 |
|
236 |
1.1 |
|
237 |
1.1 2.2 3.3 |
|
244 |
1.1 |
|
249 |
1.1 |
|
255 |
1.1 |
|
259 |
1.1 |
|
263 |
1.1 |
|
271 |
1.1 |
|
273 |
1.1 |
|
287 |
1.1 |
|
288 |
1.1 2.2 |
|
289 |
1.1 |
|
292 |
1.1 |
|
297 |
1.1 |
|
298 |
1.1 |
|
301 |
1.1 |
|
308 |
1.1 2.2 |
|
310 |
1.1 |
|
311 |
1.1 2.2 |
|
314 |
1.1 2.2 |
|
317 |
1.1 2.2 |
|
318 |
1.1 |
|
322 |
1.1 |
|
325 |
1.1 |
|
331 |
1.1 |
|
333 |
1.1 |
|
334 |
1.1 |
|
335 |
1.1 |
|
337 |
1.1 |