| 1 | package org.egothor.methodatlas.command; | |
| 2 | ||
| 3 | import java.io.IOException; | |
| 4 | import java.io.PrintWriter; | |
| 5 | import java.nio.file.Path; | |
| 6 | ||
| 7 | import org.egothor.methodatlas.DeltaReport; | |
| 8 | import org.egothor.methodatlas.emit.DeltaEmitter; | |
| 9 | ||
| 10 | /** | |
| 11 | * CLI command handler for the {@code -diff} mode. | |
| 12 | * | |
| 13 | * <p> | |
| 14 | * Compares two MethodAtlas scan CSV outputs and emits a delta report showing | |
| 15 | * added, removed, and modified test methods. | |
| 16 | * </p> | |
| 17 | * | |
| 18 | * @see org.egothor.methodatlas.DeltaReport | |
| 19 | * @see org.egothor.methodatlas.emit.DeltaEmitter | |
| 20 | */ | |
| 21 | public final class DiffCommand implements Command { | |
| 22 | ||
| 23 | private final Path before; | |
| 24 | private final Path after; | |
| 25 | ||
| 26 | /** | |
| 27 | * Creates a new diff command. | |
| 28 | * | |
| 29 | * @param before path to the <em>before</em> scan CSV | |
| 30 | * @param after path to the <em>after</em> scan CSV | |
| 31 | */ | |
| 32 | public DiffCommand(Path before, Path after) { | |
| 33 | this.before = before; | |
| 34 | this.after = after; | |
| 35 | } | |
| 36 | ||
| 37 | /** | |
| 38 | * Computes and emits the delta between the two scan CSV outputs. | |
| 39 | * | |
| 40 | * @param out writer that receives the delta report | |
| 41 | * @return {@code 0} always; errors reading the files propagate as | |
| 42 | * {@link IOException} | |
| 43 | * @throws IOException if either CSV file cannot be read | |
| 44 | */ | |
| 45 | @Override | |
| 46 | public int execute(PrintWriter out) throws IOException { | |
| 47 | DeltaReport.DeltaResult result = DeltaReport.compute(before, after); | |
| 48 |
1
1. execute : removed call to org/egothor/methodatlas/emit/DeltaEmitter::emit → KILLED |
DeltaEmitter.emit(result, out); |
| 49 | return 0; | |
| 50 | } | |
| 51 | } | |
Mutations | ||
| 48 |
1.1 |