Refactor the SimpleTestReportFormatter to use the interface.
This commit is contained in:
+3
-22
@@ -5,19 +5,16 @@ import space.kklochko.simple_jbdd.tests.Test;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SimpleTestReportFormatter {
|
||||
private ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData;
|
||||
private boolean isPassed;
|
||||
public class SimpleTestReportFormatter extends AbstractTestReportFormatter {
|
||||
final private String passedIcon = "✓";
|
||||
final private String failedIcon = "⨯";
|
||||
|
||||
public SimpleTestReportFormatter(ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData, boolean isPassed) {
|
||||
setTestMetaData(testMetaData);
|
||||
setPassed(isPassed);
|
||||
super(testMetaData, isPassed);
|
||||
}
|
||||
|
||||
public String format() {
|
||||
String status = (isPassed) ? getPassedIcon() : getFailedIcon();
|
||||
String status = (isPassed()) ? getPassedIcon() : getFailedIcon();
|
||||
String title = getTestMetaData().get(0).getValue();
|
||||
|
||||
String result = String.format("%s %s\n", status, title);
|
||||
@@ -30,22 +27,6 @@ public class SimpleTestReportFormatter {
|
||||
return result;
|
||||
}
|
||||
|
||||
public ArrayList<AbstractMap.SimpleEntry<String, String>> getTestMetaData() {
|
||||
return testMetaData;
|
||||
}
|
||||
|
||||
public void setTestMetaData(ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData) {
|
||||
this.testMetaData = testMetaData;
|
||||
}
|
||||
|
||||
public boolean isPassed() {
|
||||
return isPassed;
|
||||
}
|
||||
|
||||
public void setPassed(boolean passed) {
|
||||
isPassed = passed;
|
||||
}
|
||||
|
||||
public String getPassedIcon() {
|
||||
return passedIcon;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user