From aab945b139ba8ed250c41027d6b1c8127ad993a1 Mon Sep 17 00:00:00 2001 From: Julien Kronegg Date: Tue, 6 Jun 2023 07:36:19 +0200 Subject: [PATCH] fix: corrected failing testcase for #2762 --- .../core/plugin/StubPickleStepTestStep.java | 16 ++++++++++++++-- .../cucumber/core/plugin/UsageFormatterTest.java | 8 ++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cucumber-core/src/test/java/io/cucumber/core/plugin/StubPickleStepTestStep.java b/cucumber-core/src/test/java/io/cucumber/core/plugin/StubPickleStepTestStep.java index b4c42976b0..63b715f9f3 100644 --- a/cucumber-core/src/test/java/io/cucumber/core/plugin/StubPickleStepTestStep.java +++ b/cucumber-core/src/test/java/io/cucumber/core/plugin/StubPickleStepTestStep.java @@ -10,10 +10,22 @@ import java.util.UUID; class StubPickleStepTestStep implements PickleStepTestStep { + private final String pattern; + private final String stepText; + + public StubPickleStepTestStep() { + this.pattern = null; + this.stepText = null; + } + + public StubPickleStepTestStep(String pattern, String stepText) { + this.pattern = pattern; + this.stepText = stepText; + } @Override public String getPattern() { - return null; + return pattern; } @Override @@ -43,7 +55,7 @@ public URI getUri() { @Override public String getStepText() { - return null; + return stepText; } @Override diff --git a/cucumber-core/src/test/java/io/cucumber/core/plugin/UsageFormatterTest.java b/cucumber-core/src/test/java/io/cucumber/core/plugin/UsageFormatterTest.java index 83ca8148ba..c11244b06a 100644 --- a/cucumber-core/src/test/java/io/cucumber/core/plugin/UsageFormatterTest.java +++ b/cucumber-core/src/test/java/io/cucumber/core/plugin/UsageFormatterTest.java @@ -30,7 +30,7 @@ class UsageFormatterTest { void resultWithPassedStep() { OutputStream out = new ByteArrayOutputStream(); UsageFormatter usageFormatter = new UsageFormatter(out); - TestStep testStep = new StubPickleStepTestStep(); + TestStep testStep = new StubPickleStepTestStep("stepDef", "step"); Result result = new Result(Status.PASSED, Duration.ofMillis(12345L), null); usageFormatter @@ -49,7 +49,7 @@ void resultWithPassedStep() { void resultWithPassedAndFailedStep() { OutputStream out = new ByteArrayOutputStream(); UsageFormatter usageFormatter = new UsageFormatter(out); - TestStep testStep = new StubPickleStepTestStep(); + TestStep testStep = new StubPickleStepTestStep("stepDef", "step"); Result passed = new Result(Status.PASSED, Duration.ofSeconds(12345L), null); usageFormatter @@ -72,7 +72,7 @@ void resultWithPassedAndFailedStep() { void resultWithZeroDuration() { OutputStream out = new ByteArrayOutputStream(); UsageFormatter usageFormatter = new UsageFormatter(out); - TestStep testStep = new StubPickleStepTestStep(); + TestStep testStep = new StubPickleStepTestStep("stepDef", "step"); Result result = new Result(Status.PASSED, Duration.ZERO, null); usageFormatter @@ -92,7 +92,7 @@ void resultWithZeroDuration() { void resultWithNullDuration() { OutputStream out = new ByteArrayOutputStream(); UsageFormatter usageFormatter = new UsageFormatter(out); - PickleStepTestStep testStep = new StubPickleStepTestStep(); + PickleStepTestStep testStep = new StubPickleStepTestStep("stepDef", "step"); Result result = new Result(Status.PASSED, Duration.ZERO, null); usageFormatter