Skip to content

Commit c15e0bf

Browse files
committed
Merge remote-tracking branch 'origin/main' into renovate/major-messages-and-dependants
2 parents d6c7ecb + 0598529 commit c15e0bf

File tree

20 files changed

+296
-94
lines changed

20 files changed

+296
-94
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
## [Unreleased]
1313
### Fixed
1414
- [Core] Include root cause when using DataTable.asList and friends ([#2949](https://github.com/cucumber/cucumber-jvm/pull/2949) M.P. Korstanje)
15+
- [Core] Indent stacktrace in pretty formatter ([#2970](https://github.com/cucumber/cucumber-jvm/pull/2970) M.P. Korstanje)
1516
- [JUnit Platform Engine] Set Engine-Version-cucumber attribute ([#2963](https://github.com/cucumber/cucumber-jvm/pull/2963) M.P. Korstanje)
1617

1718
### Changed
19+
- [Archetype] Replace JUnit Jupiter with AssertJ ([#2969](https://github.com/cucumber/cucumber-jvm/pull/2969) M.P. Korstanje)
1820
- [JUnit Platform Engine] Use JUnit Platform 1.11.3 (JUnit Jupiter 5.11.3)
1921

2022
### Added

cucumber-archetype/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ This is a Maven Archetype for setting up an empty Cucumber project. Used by the
66
mvn archetype:generate \
77
-DarchetypeGroupId=io.cucumber \
88
-DarchetypeArtifactId=cucumber-archetype \
9-
-DarchetypeVersion=${cucumber.version} \
9+
-DarchetypeVersion=${cucumber.version}
1010
```

cucumber-archetype/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
<properties>
1818
<junit-jupiter.version>5.11.4</junit-jupiter.version>
19+
<assertj.version>3.25.3</assertj.version>
1920
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
2021
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
2122
</properties>
@@ -39,6 +40,16 @@
3940
<type>pom</type>
4041
<scope>import</scope>
4142
</dependency>
43+
<!-- Not used by this module. But ensures the assertj.version
44+
in the archetype template is also automatically updated by renovate
45+
bot. -->
46+
<dependency>
47+
<groupId>org.assertj</groupId>
48+
<artifactId>assertj-bom</artifactId>
49+
<version>${assertj.version}</version>
50+
<type>pom</type>
51+
<scope>import</scope>
52+
</dependency>
4253
</dependencies>
4354
</dependencyManagement>
4455

cucumber-archetype/src/main/resources/archetype-resources/pom.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
<type>pom</type>
3030
<scope>import</scope>
3131
</dependency>
32+
<dependency>
33+
<groupId>org.assertj</groupId>
34+
<artifactId>assertj-bom</artifactId>
35+
<version>${assertj.version}</version>
36+
<type>pom</type>
37+
<scope>import</scope>
38+
</dependency>
3239
</dependencies>
3340
</dependencyManagement>
3441

@@ -52,8 +59,8 @@
5259
</dependency>
5360

5461
<dependency>
55-
<groupId>org.junit.jupiter</groupId>
56-
<artifactId>junit-jupiter</artifactId>
62+
<groupId>org.assertj</groupId>
63+
<artifactId>assertj-core</artifactId>
5764
<scope>test</scope>
5865
</dependency>
5966
</dependencies>

cucumber-archetype/src/main/resources/archetype-resources/src/test/java/StepDefinitions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import io.cucumber.java.en.*;
44

5-
import static org.junit.jupiter.api.Assertions.*;
5+
import static org.assertj.core.api.Assertions.assertThat;
66

77
public class StepDefinitions {
88

cucumber-archetype/src/test/resources/projects/should-generate-project/reference/pom.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
<type>pom</type>
3030
<scope>import</scope>
3131
</dependency>
32+
<dependency>
33+
<groupId>org.assertj</groupId>
34+
<artifactId>assertj-bom</artifactId>
35+
<version>${assertj.version}</version>
36+
<type>pom</type>
37+
<scope>import</scope>
38+
</dependency>
3239
</dependencies>
3340
</dependencyManagement>
3441

@@ -52,8 +59,8 @@
5259
</dependency>
5360

5461
<dependency>
55-
<groupId>org.junit.jupiter</groupId>
56-
<artifactId>junit-jupiter</artifactId>
62+
<groupId>org.assertj</groupId>
63+
<artifactId>assertj-core</artifactId>
5764
<scope>test</scope>
5865
</dependency>
5966
</dependencies>

cucumber-archetype/src/test/resources/projects/should-generate-project/reference/src/test/java/com/example/StepDefinitions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import io.cucumber.java.en.*;
44

5-
import static org.junit.jupiter.api.Assertions.*;
5+
import static org.assertj.core.api.Assertions.assertThat;
66

77
public class StepDefinitions {
88

cucumber-bom/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
<ci-environment.version>10.0.1</ci-environment.version>
1717
<cucumber-expressions.version>18.0.1</cucumber-expressions.version>
1818
<gherkin.version>31.0.0</gherkin.version>
19-
<html-formatter.version>21.7.0</html-formatter.version>
20-
<junit-xml-formatter.version>0.5.0</junit-xml-formatter.version>
19+
<html-formatter.version>21.8.0</html-formatter.version>
20+
<junit-xml-formatter.version>0.7.1</junit-xml-formatter.version>
2121
<messages.version>27.1.0</messages.version>
22-
<query.version>12.2.0</query.version>
22+
<query.version>13.1.0</query.version>
2323
<tag-expressions.version>6.1.2</tag-expressions.version>
2424
<testng-xml-formatter.version>0.2.0</testng-xml-formatter.version>
2525
</properties>

cucumber-core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@
4949
public final class PrettyFormatter implements ConcurrentEventListener, ColorAware {
5050

5151
private static final String SCENARIO_INDENT = "";
52-
private static final String STEP_INDENT = " ";
53-
private static final String STEP_SCENARIO_INDENT = " ";
52+
private static final String STEP_INDENT = SCENARIO_INDENT + " ";
53+
private static final String STEP_SCENARIO_INDENT = STEP_INDENT + " ";
54+
private static final String STACK_TRACE_INDENT = STEP_SCENARIO_INDENT + " ";
5455

5556
private final Map<UUID, Integer> commentStartIndex = new HashMap<>();
5657

@@ -120,7 +121,7 @@ private void preCalculateLocationIndent(TestCaseStarted event) {
120121
private void printTags(TestCaseStarted event) {
121122
List<String> tags = event.getTestCase().getTags();
122123
if (!tags.isEmpty()) {
123-
out.println(PrettyFormatter.SCENARIO_INDENT + String.join(" ", tags));
124+
out.println(SCENARIO_INDENT + String.join(" ", tags));
124125
}
125126
}
126127

@@ -187,21 +188,23 @@ private String formatLocationComment(
187188

188189
private void printError(TestStepFinished event) {
189190
Result result = event.getResult();
190-
printError(result);
191+
printError(STACK_TRACE_INDENT, result);
191192
}
192193

193194
private void printError(TestRunFinished event) {
194195
Result result = event.getResult();
195-
printError(result);
196+
printError(SCENARIO_INDENT, result);
196197
}
197198

198-
private void printError(Result result) {
199+
private void printError(String prefix, Result result) {
199200
Throwable error = result.getError();
200201
if (error != null) {
201202
String name = result.getStatus().name().toLowerCase(ROOT);
202203
Format format = formats.get(name);
203204
String text = printStackTrace(error);
204-
out.println(" " + format.text(text));
205+
// TODO: Java 12+ use String.indent
206+
String indented = text.replaceAll("(\r\n|\r|\n)", "$1" + prefix).trim();
207+
out.println(prefix + format.text(indented));
205208
}
206209
}
207210

cucumber-core/src/test/java/io/cucumber/core/options/CommandlineOptionsParserTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.util.regex.Pattern;
4040

4141
import static io.cucumber.core.options.Constants.FILTER_TAGS_PROPERTY_NAME;
42+
import static io.cucumber.core.plugin.IsEqualCompressingLineSeparators.equalCompressingLineSeparators;
4243
import static io.cucumber.core.resource.ClasspathSupport.rootPackageUri;
4344
import static java.util.Arrays.asList;
4445
import static java.util.Collections.emptyMap;
@@ -50,7 +51,6 @@
5051
import static org.hamcrest.CoreMatchers.is;
5152
import static org.hamcrest.CoreMatchers.not;
5253
import static org.hamcrest.MatcherAssert.assertThat;
53-
import static org.hamcrest.Matchers.equalToCompressingWhiteSpace;
5454
import static org.hamcrest.collection.IsEmptyCollection.empty;
5555
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
5656
import static org.hamcrest.collection.IsMapContaining.hasEntry;
@@ -411,7 +411,7 @@ void ensure_less_than_1_thread_is_not_allowed() {
411411
parser
412412
.parse("--threads", "0")
413413
.build();
414-
assertThat(output(), equalToCompressingWhiteSpace("--threads must be > 0"));
414+
assertThat(output(), equalCompressingLineSeparators("--threads must be > 0"));
415415
assertThat(parser.exitStatus(), is(Optional.of((byte) 0x1)));
416416
}
417417

@@ -518,7 +518,7 @@ void ensure_less_than_1_count_is_not_allowed() {
518518
parser
519519
.parse("--count", "0")
520520
.build();
521-
assertThat(output(), equalToCompressingWhiteSpace("--count must be > 0"));
521+
assertThat(output(), equalCompressingLineSeparators("--count must be > 0"));
522522
assertThat(parser.exitStatus(), is(Optional.of((byte) 0x1)));
523523
}
524524

0 commit comments

Comments
 (0)