Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df7c7e2b9f | ||
|
|
28cd218bf7 | ||
|
|
ff09435c04 | ||
|
|
6d76646d16 | ||
|
|
458091a7e2 |
@@ -12,6 +12,10 @@ java {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Spock releases are available from Maven Central
|
// Spock releases are available from Maven Central
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -19,6 +23,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.google.guava:guava:32.1.2-jre'
|
implementation 'com.google.guava:guava:32.1.2-jre'
|
||||||
|
implementation 'org.apache.commons:commons-lang3:3.13.0'
|
||||||
// mandatory dependencies for using Spock
|
// mandatory dependencies for using Spock
|
||||||
implementation platform('org.apache.groovy:groovy-bom:4.0.15')
|
implementation platform('org.apache.groovy:groovy-bom:4.0.15')
|
||||||
implementation 'org.apache.groovy:groovy'
|
implementation 'org.apache.groovy:groovy'
|
||||||
|
|||||||
@@ -84,6 +84,11 @@
|
|||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>32.1.2-jre</version>
|
<version>32.1.2-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
</dependency>
|
||||||
<!-- Mandatory dependencies for using Spock -->
|
<!-- Mandatory dependencies for using Spock -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spockframework</groupId>
|
<groupId>org.spockframework</groupId>
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package space.kklochko.simple_jbdd.tests.reports.fmt;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
abstract public class AbstractTestReportFormatter {
|
||||||
|
private ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData;
|
||||||
|
private boolean isPassed;
|
||||||
|
|
||||||
|
public AbstractTestReportFormatter(ArrayList<AbstractMap.SimpleEntry<String, String>> testMetaData, boolean isPassed) {
|
||||||
|
setTestMetaData(testMetaData);
|
||||||
|
setPassed(isPassed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String format();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+7
-22
@@ -5,19 +5,20 @@ 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() {
|
||||||
|
super(null, false);
|
||||||
|
}
|
||||||
|
|
||||||
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 +31,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