Closed MoonBow-1 closed 5 months ago
Example of old isValid/validate method:
public boolean isValid(final Configuration configuration) {
boolean valid = true;
final FaultyReport faultyReport = new FaultyReport();
...
try {
faultyReport.writeFaultyRecords(configuration.faultyReportFile);
...
Refactored version:
class Example {
final FaultyReportFile faultyReportFile;
...
public boolean validate() {
boolean valid = true;
final FaultyReport faultyReport = new FaultyReport();
...
try {
faultyReport.writeFaultyRecords(faultyReportFile);
...
}
Description
Validate methods should validate self, and not be dependent on outside parameters