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.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class SimpleTestReportFormatter {
|
public class SimpleTestReportFormatter extends AbstractTestReportFormatter {
|
||||||
private ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData;
|
|
||||||
private boolean isPassed;
|
|
||||||
final private String passedIcon = "✓";
|
final private String passedIcon = "✓";
|
||||||
final private String failedIcon = "⨯";
|
final private String failedIcon = "⨯";
|
||||||
|
|
||||||
public SimpleTestReportFormatter(ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData, boolean isPassed) {
|
public SimpleTestReportFormatter(ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData, boolean isPassed) {
|
||||||
setTestMetaData(testMetaData);
|
super(testMetaData, isPassed);
|
||||||
setPassed(isPassed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format() {
|
public String format() {
|
||||||
String status = (isPassed) ? getPassedIcon() : getFailedIcon();
|
String status = (isPassed()) ? getPassedIcon() : getFailedIcon();
|
||||||
String title = getTestMetaData().get(0).getValue();
|
String title = getTestMetaData().get(0).getValue();
|
||||||
|
|
||||||
String result = String.format("%s %s\n", status, title);
|
String result = String.format("%s %s\n", status, title);
|
||||||
@@ -30,22 +27,6 @@ public class SimpleTestReportFormatter {
|
|||||||
return result;
|
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() {
|
public String getPassedIcon() {
|
||||||
return passedIcon;
|
return passedIcon;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user