| 1 | package com.github.valid8j.metamor; | |
| 2 | ||
| 3 | import com.github.valid8j.pcond.core.EvaluationEntry; | |
| 4 | import com.github.valid8j.pcond.core.Evaluator; | |
| 5 | import com.github.valid8j.pcond.internals.InternalUtils; | |
| 6 | import com.github.valid8j.pcond.validator.ReportComposer; | |
| 7 | ||
| 8 | import static com.github.valid8j.pcond.core.EvaluationEntry.Type.FUNCTION; | |
| 9 | ||
| 10 | public class MetamorphicReportComposer implements ReportComposer { | |
| 11 | ||
| 12 | @Override | |
| 13 | public FormattedEntry createFormattedEntryForExpectation(EvaluationEntry evaluationEntry) { | |
| 14 |
1
1. createFormattedEntryForExpectation : negated conditional → SURVIVED |
if (evaluationEntry.type() == FUNCTION) |
| 15 |
1
1. createFormattedEntryForExpectation : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::createFormattedEntryForExpectation → SURVIVED |
return new FormattedEntry( |
| 16 | InternalUtils.formatObject(extractInput(evaluationEntry.inputExpectation())), | |
| 17 | evaluationEntry.formName(), | |
| 18 | InternalUtils.indent(evaluationEntry.level()), | |
| 19 | InternalUtils.formatObject(extractOutput(evaluationEntry.outputExpectation())), | |
| 20 | isExplanationRequiredForExpectation(evaluationEntry) | |
| 21 | ); | |
| 22 |
1
1. createFormattedEntryForExpectation : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::createFormattedEntryForExpectation → SURVIVED |
return Utils.createFormattedEntryForExpectation(this, evaluationEntry); |
| 23 | } | |
| 24 | ||
| 25 | @Override | |
| 26 | public FormattedEntry createFormattedEntryForActualValue(EvaluationEntry evaluationEntry) { | |
| 27 |
1
1. createFormattedEntryForActualValue : negated conditional → SURVIVED |
if (evaluationEntry.type() == FUNCTION) |
| 28 |
1
1. createFormattedEntryForActualValue : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::createFormattedEntryForActualValue → SURVIVED |
return new FormattedEntry( |
| 29 | InternalUtils.formatObject(extractInput(evaluationEntry.inputActualValue())), | |
| 30 | evaluationEntry.formName(), | |
| 31 | InternalUtils.indent(evaluationEntry.level()), | |
| 32 | InternalUtils.formatObject(extractOutput(evaluationEntry.outputActualValue())), | |
| 33 | isExplanationRequiredForActualValue(evaluationEntry)); | |
| 34 |
1
1. createFormattedEntryForActualValue : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::createFormattedEntryForActualValue → SURVIVED |
return Utils.createFormattedEntryForActualValue(this, evaluationEntry); |
| 35 | } | |
| 36 | ||
| 37 | @Override | |
| 38 | public boolean requiresExplanation(EvaluationEntry evaluationEntry) { | |
| 39 |
1
1. requiresExplanation : negated conditional → SURVIVED |
if (evaluationEntry.outputExpectation() instanceof IoContext.Ongoing.Snapshot) |
| 40 |
1
1. requiresExplanation : replaced boolean return with false for com/github/valid8j/metamor/MetamorphicReportComposer::requiresExplanation → SURVIVED |
return true; |
| 41 |
2
1. requiresExplanation : replaced boolean return with false for com/github/valid8j/metamor/MetamorphicReportComposer::requiresExplanation → SURVIVED 2. requiresExplanation : replaced boolean return with true for com/github/valid8j/metamor/MetamorphicReportComposer::requiresExplanation → SURVIVED |
return ReportComposer.super.requiresExplanation(evaluationEntry); |
| 42 | } | |
| 43 | ||
| 44 | private Object extractInput(Object o) { | |
| 45 |
1
1. extractInput : negated conditional → SURVIVED |
if (o instanceof IoContext.Ongoing.Snapshot) |
| 46 |
1
1. extractInput : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::extractInput → NO_COVERAGE |
return ((IoContext.Ongoing.Snapshot) o).in(); |
| 47 |
1
1. extractInput : negated conditional → SURVIVED |
if (o instanceof Evaluator.Snapshottable) { |
| 48 | Object s = ((Evaluator.Snapshottable) o).snapshot(); | |
| 49 |
1
1. extractInput : negated conditional → SURVIVED |
if (s instanceof IoContext.Ongoing.Snapshot) |
| 50 |
1
1. extractInput : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::extractInput → SURVIVED |
return ((IoContext.Ongoing.Snapshot) s).in(); |
| 51 | } | |
| 52 |
1
1. extractInput : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::extractInput → SURVIVED |
return o; |
| 53 | } | |
| 54 | ||
| 55 | private static Object extractOutput(Object o) { | |
| 56 |
1
1. extractOutput : negated conditional → SURVIVED |
if (o instanceof IoContext.Ongoing.Snapshot) |
| 57 |
1
1. extractOutput : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::extractOutput → SURVIVED |
return ((IoContext.Ongoing.Snapshot) o).out(); |
| 58 |
1
1. extractOutput : replaced return value with null for com/github/valid8j/metamor/MetamorphicReportComposer::extractOutput → SURVIVED |
return o; |
| 59 | } | |
| 60 | ||
| 61 | private static boolean isExplanationRequiredForExpectation(EvaluationEntry evaluationEntry) { | |
| 62 |
2
1. isExplanationRequiredForExpectation : replaced boolean return with false for com/github/valid8j/metamor/MetamorphicReportComposer::isExplanationRequiredForExpectation → SURVIVED 2. isExplanationRequiredForExpectation : replaced boolean return with true for com/github/valid8j/metamor/MetamorphicReportComposer::isExplanationRequiredForExpectation → SURVIVED |
return evaluationEntry.outputExpectation() instanceof IoContext.Ongoing.Snapshot; |
| 63 | } | |
| 64 | ||
| 65 | private static boolean isExplanationRequiredForActualValue(EvaluationEntry evaluationEntry) { | |
| 66 |
2
1. isExplanationRequiredForActualValue : replaced boolean return with false for com/github/valid8j/metamor/MetamorphicReportComposer::isExplanationRequiredForActualValue → SURVIVED 2. isExplanationRequiredForActualValue : replaced boolean return with true for com/github/valid8j/metamor/MetamorphicReportComposer::isExplanationRequiredForActualValue → SURVIVED |
return evaluationEntry.outputActualValue() instanceof IoContext.Ongoing.Snapshot; |
| 67 | } | |
| 68 | } | |
Mutations | ||
| 14 |
1.1 |
|
| 15 |
1.1 |
|
| 22 |
1.1 |
|
| 27 |
1.1 |
|
| 28 |
1.1 |
|
| 34 |
1.1 |
|
| 39 |
1.1 |
|
| 40 |
1.1 |
|
| 41 |
1.1 2.2 |
|
| 45 |
1.1 |
|
| 46 |
1.1 |
|
| 47 |
1.1 |
|
| 49 |
1.1 |
|
| 50 |
1.1 |
|
| 52 |
1.1 |
|
| 56 |
1.1 |
|
| 57 |
1.1 |
|
| 58 |
1.1 |
|
| 62 |
1.1 2.2 |
|
| 66 |
1.1 2.2 |