diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ResourceUtil.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ResourceUtil.java index 3ea478225b..f6a5a85ee3 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ResourceUtil.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ResourceUtil.java @@ -9,7 +9,9 @@ public static void close( Closeable... closeables ) { Exception t = null; for( Closeable c : closeables ) { try { - c.close(); + if( c != null ) { + c.close(); + } } catch( Exception e ) { t = e; } diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/DataTableScenarioHtmlWriter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/DataTableScenarioHtmlWriter.java index 9a5e18fb3f..e57101b6b1 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/DataTableScenarioHtmlWriter.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/DataTableScenarioHtmlWriter.java @@ -33,7 +33,7 @@ public void visitEnd( ScenarioCaseModel scenarioCase ) { writer.println( "
# | " ); - for( String param : scenarioModel.parameterNames ) { + for( String param : scenarioModel.getDerivedParameters() ) { writer.print( "" + param + " | " ); } writer.print( "Status | " ); @@ -42,7 +42,7 @@ public void visitEnd( ScenarioCaseModel scenarioCase ) { writer.println( "
---|---|---|
" + scenarioCase.caseNr + " | " ); - for( String arg : scenarioCase.arguments ) { + for( String arg : scenarioCase.getDerivedArguments() ) { writer.print( "" + arg + " | " ); } writer.print( "" );
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/HtmlWriter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/HtmlWriter.java
index 3952d1b58a..e7de8b2042 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/HtmlWriter.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/HtmlWriter.java
@@ -17,6 +17,7 @@
import com.google.common.base.Throwables;
import com.google.common.io.Files;
import com.tngtech.jgiven.impl.util.ResourceUtil;
+import com.tngtech.jgiven.impl.util.Version;
import com.tngtech.jgiven.report.impl.CommonReportHelper;
import com.tngtech.jgiven.report.model.ReportModel;
import com.tngtech.jgiven.report.model.ReportModelVisitor;
@@ -48,8 +49,9 @@ public void writeHtmlFooter() {
}
private void writeJGivenFooter() {
- writer.print( " Generated by JGiven - on " );
- writer.print( DateFormat.getDateTimeInstance().format( new Date() ) );
+ writer.print( " Generated by JGiven " );
+ writer.print( Version.VERSION );
+ writer.print( " - on " + DateFormat.getDateTimeInstance().format( new Date() ) );
closeDiv();
}
diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ScenarioHtmlWriter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ScenarioHtmlWriter.java
index 1b9830fbc7..c7b23c3be0 100644
--- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ScenarioHtmlWriter.java
+++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ScenarioHtmlWriter.java
@@ -97,7 +97,7 @@ public void visitEnd( ScenarioModel scenarioModel ) {
public void visit( ScenarioCaseModel scenarioCase ) {
this.scenarioCase = scenarioCase;
printCaseHeader( scenarioCase );
- String collapsed = scenarioCase.arguments.isEmpty() || scenarioModel.isCasesAsTable() ? "" : " collapsed";
+ String collapsed = scenarioCase.getExplicitArguments().isEmpty() || scenarioModel.isCasesAsTable() ? "" : " collapsed";
writer.println( "
", scenarioCase.success ? "passed" : "failed" ) );
- if( !scenarioCase.arguments.isEmpty() ) {
+ if( !scenarioCase.getExplicitArguments().isEmpty() ) {
writer.print( format( " ", getCaseId() ) );
writeStatusIcon( scenarioCase.success );
writer.print( format( " Case %d: ", scenarioCase.caseNr ) );
- for( int i = 0; i < scenarioCase.arguments.size(); i++ ) {
- if( scenarioModel.parameterNames.size() > i ) {
- writer.print( scenarioModel.parameterNames.get( i ) + " = " );
+ for( int i = 0; i < scenarioCase.getExplicitArguments().size(); i++ ) {
+ if( scenarioModel.getExplicitParameters().size() > i ) {
+ writer.print( scenarioModel.getExplicitParameters().get( i ) + " = " );
}
- writer.print( scenarioCase.arguments.get( i ) );
+ writer.print( scenarioCase.getExplicitArguments().get( i ) );
- if( i < scenarioCase.arguments.size() - 1 ) {
+ if( i < scenarioCase.getExplicitArguments().size() - 1 ) {
writer.print( ", " );
}
}
@@ -147,9 +147,9 @@ public void visit( StepModel stepModel ) {
if( !firstWord ) {
writer.print( ' ' );
}
- String text = HtmlEscapers.htmlEscaper().escape( word.value );
+ String text = HtmlEscapers.htmlEscaper().escape( word.getValue() );
- if( firstWord && word.isIntroWord ) {
+ if( firstWord && word.isIntroWord() ) {
writer.print( format( "%s", WordUtil.capitalize( text ) ) );
} else if( word.isArg() ) {
printArg( word );
@@ -171,7 +171,8 @@ public void visit( StepModel stepModel ) {
}
private void printArg( Word word ) {
- String value = word.getArgumentInfo().isParameter() ? formatCaseArgument( word ) : HtmlEscapers.htmlEscaper().escape( word.value );
+ String value = word.getArgumentInfo().isParameter() ? formatCaseArgument( word ) : HtmlEscapers.htmlEscaper().escape(
+ word.getFormattedValue() );
value = escapeToHtml( value );
String multiLine = value.contains( " |