From 440b54cfbea1a4b457108225f6df4a0eafa792fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4fer?= Date: Tue, 30 Sep 2014 22:36:51 +0200 Subject: [PATCH] some cleanups --- .../tngtech/jgiven/impl/ScenarioExecutor.java | 1 + .../impl/intercept/NoOpScenarioListener.java | 2 +- .../impl/intercept/ScenarioListener.java | 2 +- .../jgiven/impl/util/AssertionUtil.java | 2 +- .../jgiven/impl/util/PrintWriterUtil.java | 30 ++++++++++ .../jgiven/impl/util/ScenarioUtil.java | 2 +- .../report/analysis/CaseArgumentAnalyser.java | 1 - .../report/html/ReportModelHtmlWriter.java | 4 +- .../html/SingleFileHtmlReportGenerator.java | 55 ------------------- .../report/html/StatisticsPageHtmlWriter.java | 4 +- .../report/impl/CommonReportHelper.java | 22 -------- .../jgiven/report/model/ArgumentInfo.java | 20 +------ .../{impl => report/model}/NamedArgument.java | 2 +- .../report/model/ReportModelBuilder.java | 1 - .../jgiven/report/model/StepFormatter.java | 1 - .../report/text/PlainTextReportGenerator.java | 4 +- .../jgiven/report/text/PlainTextReporter.java | 4 +- .../jgiven/format/StepFormatterTest.java | 2 +- .../jgiven/impl/util/ScenarioUtilTest.java | 2 +- .../jgiven/junit/ScenarioExecutionRule.java | 2 +- .../jgiven/junit/ScenarioTestRuleTest.java | 2 +- .../jgiven/testng/ScenarioTestListener.java | 2 +- .../jgiven/tests/TestScenarioRepository.java | 4 +- 23 files changed, 53 insertions(+), 118 deletions(-) create mode 100644 jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/PrintWriterUtil.java delete mode 100644 jgiven-core/src/main/java/com/tngtech/jgiven/report/html/SingleFileHtmlReportGenerator.java rename jgiven-core/src/main/java/com/tngtech/jgiven/{impl => report/model}/NamedArgument.java (95%) diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioExecutor.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioExecutor.java index d7e694aede..60ec127fef 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioExecutor.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/ScenarioExecutor.java @@ -44,6 +44,7 @@ import com.tngtech.jgiven.impl.util.ReflectionUtil.MethodAction; import com.tngtech.jgiven.impl.util.ScenarioUtil; import com.tngtech.jgiven.integration.CanWire; +import com.tngtech.jgiven.report.model.NamedArgument; /** * Main class of JGiven for executing scenarios. diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/NoOpScenarioListener.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/NoOpScenarioListener.java index 74ff461ddf..37bcd1f3f7 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/NoOpScenarioListener.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/NoOpScenarioListener.java @@ -3,7 +3,7 @@ import java.lang.reflect.Method; import java.util.List; -import com.tngtech.jgiven.impl.NamedArgument; +import com.tngtech.jgiven.report.model.NamedArgument; public class NoOpScenarioListener implements ScenarioListener { diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/ScenarioListener.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/ScenarioListener.java index a09967cc40..748f3f918b 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/ScenarioListener.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/intercept/ScenarioListener.java @@ -3,7 +3,7 @@ import java.lang.reflect.Method; import java.util.List; -import com.tngtech.jgiven.impl.NamedArgument; +import com.tngtech.jgiven.report.model.NamedArgument; public interface ScenarioListener { diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/AssertionUtil.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/AssertionUtil.java index 6948e9509d..f7ebb75fd5 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/AssertionUtil.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/AssertionUtil.java @@ -9,7 +9,7 @@ public class AssertionUtil { public static void assertNotNull( Object o ) { - assertNotNull( "Expected a value to not be null, but it apparently was null" ); + assertNotNull( o, "Expected a value to not be null, but it apparently was null" ); } public static void assertNotNull( Object o, String msg ) { diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/PrintWriterUtil.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/PrintWriterUtil.java new file mode 100644 index 0000000000..f652552e68 --- /dev/null +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/PrintWriterUtil.java @@ -0,0 +1,30 @@ +package com.tngtech.jgiven.impl.util; + +import java.io.File; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; + +import com.google.common.base.Charsets; +import com.google.common.base.Throwables; + +public class PrintWriterUtil { + + public static PrintWriter getPrintWriter( File file ) { + try { + return new PrintWriter( file, Charsets.UTF_8.name() ); + } catch( Exception e ) { + throw Throwables.propagate( e ); + } + } + + public static PrintWriter getPrintWriter( OutputStream outputStream ) { + try { + return new PrintWriter( new OutputStreamWriter( outputStream, Charsets.UTF_8.name() ) ); + } catch( UnsupportedEncodingException e ) { + throw Throwables.propagate( e ); + } + } + +} diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ScenarioUtil.java b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ScenarioUtil.java index f57df13eec..4333e26a04 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ScenarioUtil.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ScenarioUtil.java @@ -15,7 +15,7 @@ import com.thoughtworks.paranamer.BytecodeReadingParanamer; import com.thoughtworks.paranamer.ParameterNamesNotFoundException; import com.thoughtworks.paranamer.Paranamer; -import com.tngtech.jgiven.impl.NamedArgument; +import com.tngtech.jgiven.report.model.NamedArgument; public class ScenarioUtil { private static final Logger log = LoggerFactory.getLogger( ScenarioUtil.class ); diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/analysis/CaseArgumentAnalyser.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/analysis/CaseArgumentAnalyser.java index b6f0b0c0b3..20f8136c62 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/analysis/CaseArgumentAnalyser.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/analysis/CaseArgumentAnalyser.java @@ -176,7 +176,6 @@ private void reduceMatrix( ScenarioModel scenarioModel, List argu for( int i = 0; i < replacement.arguments.size(); i++ ) { Word word = replacement.arguments.get( i ); word.getArgumentInfo().setParameterName( replacement.replacementName ); - word.getArgumentInfo().setDerivedParameter( replacement.isStepParameterName ); if( !duplicate ) { scenarioModel.getCase( i ).addDerivedArguments( word.getFormattedValue() ); } diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriter.java index 424a17c546..b571df05c3 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriter.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/ReportModelHtmlWriter.java @@ -16,9 +16,9 @@ import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.io.Files; +import com.tngtech.jgiven.impl.util.PrintWriterUtil; 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; import com.tngtech.jgiven.report.model.ReportStatistics; @@ -197,7 +197,7 @@ public void visit( ScenarioModel scenarioModel ) { } static ReportModelHtmlWriter writeModelToFile( ReportModel model, HtmlTocWriter tocWriter, File file ) { - PrintWriter printWriter = CommonReportHelper.getPrintWriter( file ); + PrintWriter printWriter = PrintWriterUtil.getPrintWriter( file ); try { ReportModelHtmlWriter htmlWriter = new ReportModelHtmlWriter( printWriter ); htmlWriter.write( model, tocWriter ); diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/SingleFileHtmlReportGenerator.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/SingleFileHtmlReportGenerator.java deleted file mode 100644 index 1ec2d55cf1..0000000000 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/SingleFileHtmlReportGenerator.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.tngtech.jgiven.report.html; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Charsets; -import com.tngtech.jgiven.impl.util.ResourceUtil; -import com.tngtech.jgiven.report.json.JsonModelTraverser; -import com.tngtech.jgiven.report.json.ReportModelFileHandler; -import com.tngtech.jgiven.report.model.ReportModel; - -/** - * Writes all scenarios into a single file. - */ -public class SingleFileHtmlReportGenerator implements ReportModelFileHandler { - private static final Logger log = LoggerFactory.getLogger( SingleFileHtmlReportGenerator.class ); - protected PrintWriter writer; - protected HtmlWriterUtils utils; - - public void generate( File toDir, String targetFileName, File sourceDir ) throws IOException { - log.info( "Generating file " + targetFileName + " to directory " + toDir ); - - writer = new PrintWriter( new File( toDir, targetFileName ), Charsets.UTF_8.name() ); - utils = new HtmlWriterUtils( writer ); - - try { - writeStart(); - new JsonModelTraverser().traverseModels( sourceDir, this ); - writeEnd(); - } finally { - ResourceUtil.close( writer ); - } - } - - public void writeStart() { - utils.writeHtmlHeader( "JGiven HTML Report" ); - - writer.println( "" ); - } - - @Override - public void handleReportModel( ReportModel model, File file ) { - new ReportModelHtmlWriter( writer ).visit( model ); - } - -} diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/StatisticsPageHtmlWriter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/StatisticsPageHtmlWriter.java index c8444c821c..a5ef6d54f7 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/StatisticsPageHtmlWriter.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/html/StatisticsPageHtmlWriter.java @@ -4,8 +4,8 @@ import java.io.PrintWriter; import com.tngtech.jgiven.impl.util.DurationFormatter; +import com.tngtech.jgiven.impl.util.PrintWriterUtil; import com.tngtech.jgiven.impl.util.ResourceUtil; -import com.tngtech.jgiven.report.impl.CommonReportHelper; import com.tngtech.jgiven.report.model.ReportModel; import com.tngtech.jgiven.report.model.ReportStatistics; @@ -27,7 +27,7 @@ public void write( File toDir ) { private void writeIndexFile( File toDir ) { File file = new File( toDir, "index.html" ); - printWriter = CommonReportHelper.getPrintWriter( file ); + printWriter = PrintWriterUtil.getPrintWriter( file ); utils = new HtmlWriterUtils( printWriter ); try { ReportModelHtmlWriter htmlWriter = new ReportModelHtmlWriter( printWriter ); diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/impl/CommonReportHelper.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/impl/CommonReportHelper.java index 7df2f7d8d6..8c6c77da85 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/impl/CommonReportHelper.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/impl/CommonReportHelper.java @@ -1,17 +1,11 @@ package com.tngtech.jgiven.report.impl; import java.io.File; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Charsets; import com.google.common.base.Optional; -import com.google.common.base.Throwables; import com.tngtech.jgiven.impl.Config; import com.tngtech.jgiven.report.analysis.CaseArgumentAnalyser; import com.tngtech.jgiven.report.json.ScenarioJsonWriter; @@ -47,20 +41,4 @@ public void finishReport( ReportModel model ) { new ScenarioJsonWriter( model ).write( reportFile ); } } - - public static PrintWriter getPrintWriter( File file ) { - try { - return new PrintWriter( file, Charsets.UTF_8.name() ); - } catch( Exception e ) { - throw Throwables.propagate( e ); - } - } - - public static PrintWriter getPrintWriter( OutputStream outputStream ) { - try { - return new PrintWriter( new OutputStreamWriter( outputStream, Charsets.UTF_8.name() ) ); - } catch( UnsupportedEncodingException e ) { - throw Throwables.propagate( e ); - } - } } diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ArgumentInfo.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ArgumentInfo.java index f1c3b5ec93..27f2c31aca 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ArgumentInfo.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ArgumentInfo.java @@ -13,12 +13,6 @@ public class ArgumentInfo { */ private String parameterName; - /** - * Whether this argument is actually a derived parameter. - * Note that in that case parameterName is equal to argumentName - */ - private boolean isDerivedParameter; - /** * The name of the argument as declared in the step method. * Should never be {@code null}. @@ -61,14 +55,6 @@ public String getArgumentName() { return argumentName; } - public void setDerivedParameter( boolean isDerivedParameter ) { - this.isDerivedParameter = isDerivedParameter; - } - - public boolean isDerivedParameter() { - return isDerivedParameter; - } - public void setFormattedValue( String formattedValue ) { this.formattedValue = formattedValue; } @@ -79,7 +65,7 @@ public String getFormattedValue() { @Override public int hashCode() { - return Objects.hashCode( parameterName, argumentName, isDerivedParameter ); + return Objects.hashCode( parameterName, argumentName ); } @Override @@ -95,8 +81,6 @@ public boolean equals( Object obj ) { } ArgumentInfo other = (ArgumentInfo) obj; return Objects.equal( parameterName, other.parameterName ) - && Objects.equal( argumentName, other.argumentName ) - && ( isDerivedParameter == other.isDerivedParameter ); + && Objects.equal( argumentName, other.argumentName ); } - } diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/NamedArgument.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/NamedArgument.java similarity index 95% rename from jgiven-core/src/main/java/com/tngtech/jgiven/impl/NamedArgument.java rename to jgiven-core/src/main/java/com/tngtech/jgiven/report/model/NamedArgument.java index a26c2da214..4ddfdacdd7 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/impl/NamedArgument.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/NamedArgument.java @@ -1,4 +1,4 @@ -package com.tngtech.jgiven.impl; +package com.tngtech.jgiven.report.model; import com.google.common.base.Objects; diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java index 72359aac33..6b47061dad 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/ReportModelBuilder.java @@ -29,7 +29,6 @@ import com.tngtech.jgiven.config.TagConfiguration; import com.tngtech.jgiven.format.DefaultFormatter; import com.tngtech.jgiven.format.PrintfFormatter; -import com.tngtech.jgiven.impl.NamedArgument; import com.tngtech.jgiven.impl.intercept.InvocationMode; import com.tngtech.jgiven.impl.intercept.ScenarioListener; import com.tngtech.jgiven.impl.util.AssertionUtil; diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java index c75199143f..550bf0e655 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java @@ -8,7 +8,6 @@ import com.google.common.collect.Lists; import com.tngtech.jgiven.format.ArgumentFormatter; import com.tngtech.jgiven.format.DefaultFormatter; -import com.tngtech.jgiven.impl.NamedArgument; public class StepFormatter { private final String stepDescription; diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReportGenerator.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReportGenerator.java index 4f153ff666..7c01c53882 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReportGenerator.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReportGenerator.java @@ -4,8 +4,8 @@ import java.io.PrintWriter; import com.google.common.io.Files; +import com.tngtech.jgiven.impl.util.PrintWriterUtil; import com.tngtech.jgiven.impl.util.ResourceUtil; -import com.tngtech.jgiven.report.impl.CommonReportHelper; import com.tngtech.jgiven.report.json.JsonModelTraverser; import com.tngtech.jgiven.report.json.ReportModelFileHandler; import com.tngtech.jgiven.report.model.ReportModel; @@ -17,7 +17,7 @@ public class PlainTextReportGenerator implements ReportModelFileHandler { @Override public void handleReportModel( ReportModel model, File file ) { String targetFileName = Files.getNameWithoutExtension( file.getName() ) + ".feature"; - PrintWriter printWriter = CommonReportHelper.getPrintWriter( new File( toDir, targetFileName ) ); + PrintWriter printWriter = PrintWriterUtil.getPrintWriter( new File( toDir, targetFileName ) ); try { model.accept( new PlainTextScenarioWriter( printWriter, false ) ); diff --git a/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReporter.java b/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReporter.java index b2e89aaf9a..7957ef9c43 100644 --- a/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReporter.java +++ b/jgiven-core/src/main/java/com/tngtech/jgiven/report/text/PlainTextReporter.java @@ -9,8 +9,8 @@ import org.fusesource.jansi.Ansi.Color; import com.tngtech.jgiven.impl.Config; +import com.tngtech.jgiven.impl.util.PrintWriterUtil; import com.tngtech.jgiven.impl.util.ResourceUtil; -import com.tngtech.jgiven.report.impl.CommonReportHelper; import com.tngtech.jgiven.report.model.ReportModel; import com.tngtech.jgiven.report.model.ScenarioModel; @@ -37,7 +37,7 @@ public PlainTextReporter() { } public PlainTextReporter( boolean withColor ) { - this( CommonReportHelper.getPrintWriter( System.out ), withColor ); + this( PrintWriterUtil.getPrintWriter( System.out ), withColor ); } public PlainTextReporter( PrintWriter printWriter, boolean withColor ) { diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/format/StepFormatterTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/format/StepFormatterTest.java index 02bcff5546..de91fd81e7 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/format/StepFormatterTest.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/format/StepFormatterTest.java @@ -15,7 +15,7 @@ import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; -import com.tngtech.jgiven.impl.NamedArgument; +import com.tngtech.jgiven.report.model.NamedArgument; import com.tngtech.jgiven.report.model.StepFormatter; import com.tngtech.jgiven.report.model.StepFormatter.Formatting; import com.tngtech.jgiven.report.model.Word; diff --git a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ScenarioUtilTest.java b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ScenarioUtilTest.java index 6c9815f0e8..06e2868746 100644 --- a/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ScenarioUtilTest.java +++ b/jgiven-core/src/test/java/com/tngtech/jgiven/impl/util/ScenarioUtilTest.java @@ -15,7 +15,7 @@ import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; -import com.tngtech.jgiven.impl.NamedArgument; +import com.tngtech.jgiven.report.model.NamedArgument; @RunWith( DataProviderRunner.class ) public class ScenarioUtilTest { diff --git a/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/ScenarioExecutionRule.java b/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/ScenarioExecutionRule.java index c9c909fdd3..b5b3da47f0 100644 --- a/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/ScenarioExecutionRule.java +++ b/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/ScenarioExecutionRule.java @@ -26,10 +26,10 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.primitives.Primitives; -import com.tngtech.jgiven.impl.NamedArgument; import com.tngtech.jgiven.impl.ScenarioBase; import com.tngtech.jgiven.impl.util.ReflectionUtil; import com.tngtech.jgiven.impl.util.ScenarioUtil; +import com.tngtech.jgiven.report.model.NamedArgument; import com.tngtech.jgiven.report.model.ReportModelBuilder; public class ScenarioExecutionRule implements MethodRule { diff --git a/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/ScenarioTestRuleTest.java b/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/ScenarioTestRuleTest.java index ce9085ef19..e89fbcd9df 100644 --- a/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/ScenarioTestRuleTest.java +++ b/jgiven-junit/src/test/java/com/tngtech/jgiven/junit/ScenarioTestRuleTest.java @@ -18,7 +18,7 @@ import com.tngtech.java.junit.dataprovider.DataProviderFrameworkMethod; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; -import com.tngtech.jgiven.impl.NamedArgument; +import com.tngtech.jgiven.report.model.NamedArgument; @RunWith( DataProviderRunner.class ) public class ScenarioTestRuleTest { diff --git a/jgiven-testng/src/main/java/com/tngtech/jgiven/testng/ScenarioTestListener.java b/jgiven-testng/src/main/java/com/tngtech/jgiven/testng/ScenarioTestListener.java index b66a64f71a..10f30304c3 100644 --- a/jgiven-testng/src/main/java/com/tngtech/jgiven/testng/ScenarioTestListener.java +++ b/jgiven-testng/src/main/java/com/tngtech/jgiven/testng/ScenarioTestListener.java @@ -10,10 +10,10 @@ import org.testng.ITestResult; import com.tngtech.jgiven.base.ScenarioTestBase; -import com.tngtech.jgiven.impl.NamedArgument; import com.tngtech.jgiven.impl.ScenarioBase; import com.tngtech.jgiven.impl.util.ScenarioUtil; import com.tngtech.jgiven.report.impl.CommonReportHelper; +import com.tngtech.jgiven.report.model.NamedArgument; import com.tngtech.jgiven.report.model.ReportModel; import com.tngtech.jgiven.report.model.ReportModelBuilder; diff --git a/jgiven-tests/src/main/java/com/tngtech/jgiven/tests/TestScenarioRepository.java b/jgiven-tests/src/main/java/com/tngtech/jgiven/tests/TestScenarioRepository.java index 4772c72190..7d25be06ba 100644 --- a/jgiven-tests/src/main/java/com/tngtech/jgiven/tests/TestScenarioRepository.java +++ b/jgiven-tests/src/main/java/com/tngtech/jgiven/tests/TestScenarioRepository.java @@ -37,11 +37,11 @@ public boolean matches( ScenarioCriteria criteria ) { return false; } - if( numberOfSteps != null && numberOfSteps != criteria.numberOfSteps ) { + if( numberOfSteps != null && !numberOfSteps.equals( criteria.numberOfSteps ) ) { return false; } - if( numberOfFailingStages != null && numberOfFailingStages != criteria.numberOfFailingStages ) { + if( numberOfFailingStages != null && !numberOfFailingStages.equals( criteria.numberOfFailingStages ) ) { return false; }