Skip to content

Commit 5dd201f

Browse files
authored
Merge pull request #1782 from cucumber/lambda-type-annotations-continued
Continue Lambda type annotations
2 parents 9251ef0 + e727622 commit 5dd201f

File tree

327 files changed

+3269
-3115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

327 files changed

+3269
-3115
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: Bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Context & Motivation**
24+
25+
How has this issue affected you? What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world.
26+
27+
**Screenshots**
28+
If applicable, add screenshots to help explain your problem.
29+
30+
**Your Environment**
31+
- Versions used [e.g 5.0.0]
32+
- Operating System and version [e.g. * Operating System and version:]
33+
- Build tool [e.g. Apache Maven 3.6.0]
34+
35+
**Additional context**
36+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: Feature Request
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
- jdk: openjdk11
2525
script: mvn -q verify
2626

27-
# 1.3 Check java doc
28-
- jdk: openjdk8
27+
# 1.3 Check javadoc. We need to use this version to properly detect errors.
28+
- jdk: oraclejdk11
2929
env: JAVADOC=true
3030
script:
3131
- mvn clean verify -DskipTests=true

CHANGELOG.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
44
## [5.0.0-SNAPSHOT](https://github.com/cucumber/cucumber-jvm/compare/v4.7.1...master) (In Git)
55

66
### Added
7+
* [Core] Upgrade the timeline formatter's jQuery dependency from 3.3.1 to 3.4.1. jQuery 3.3.1 has an [XSS vulnerability](https://www.cvedetails.com/cve/CVE-2019-11358/)
8+
that wouldn't normally affect the timeline formatter. However, it did prevent some organisations from downloading the cucumber-core jar because nexus would block it.
9+
([#1759](https://github.com/cucumber/cucumber-jvm/issues/1759), [#1769](https://github.com/cucumber/cucumber-jvm/pull/1769) Vincent Pretre, Aslak Hellesøy)
710
* [Core] Add `object-factory` option to CLI and `@CucumberOptions`. ([#1710](https://github.com/cucumber/cucumber-jvm/pull/1710) Ralph Kar)
811
* [Java] Allow parameter types access to the test context ([#851](https://github.com/cucumber/cucumber-jvm/issues/851), [#1458](https://github.com/cucumber/cucumber-jvm/issues/1458) M.P. Korstanje)
912
- Add `@ParameterType` alternative for `TypeRegistry.defineParameterType`
@@ -23,11 +26,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
2326
- cucumber.execution.dry-run
2427
- cucumber.execution.limit
2528
- cucumber.execution.order
26-
- cucumber.execution.parallel.config.fixed.parallelism
2729
- cucumber.execution.strict
2830
- cucumber.execution.wip
2931
- cucumber.feature
30-
- cucumber.rerun-file
3132
- cucumber.filter.name
3233
- cucumber.filter.tags
3334
- cucumber.glue
@@ -36,11 +37,12 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
3637
- cucumber.snippet-type
3738

3839
### Changed
39-
* [All] New package structure ([#1445](https://github.com/cucumber/cucumber-jvm/pull/1445), [#1448](https://github.com/cucumber/cucumber-jvm/issues/1448), [#1449](https://github.com/cucumber/cucumber-jvm/pull/1449) M.P. Korstanje)
40+
* [All] New package structure ([#1445](https://github.com/cucumber/cucumber-jvm/pull/1445), [#1448](https://github.com/cucumber/cucumber-jvm/issues/1448), [#1449](https://github.com/cucumber/cucumber-jvm/pull/1449), [#1760](https://github.com/cucumber/cucumber-jvm/pull/1760) M.P. Korstanje)
4041
- Adds `Automatic-Module-Name` to each module
4142
- Roots packages in `io.cucumber.<module>`
4243
- Use `find . -name '*.java' -exec sed -i 's/import cucumber.api/import io.cucumber/g' {} \; -exec sed -i 's/cucumber.CucumberOptions/cucumber.junit.CucumberOptions/g' {} \;` to adopt 90% of the new package structure
4344
- Use @API Guardian annotations to mark the public API ([#1536](https://github.com/cucumber/cucumber-jvm/issues/1536) M.P. Korstanje)
45+
- Limits the transitive use `cucumber-core` for regular users
4446
* [All] Compile using source and target level 8 ([#1611](https://github.com/cucumber/cucumber-jvm/issues/1611) M.P. Korstanje)
4547
* [Java8] Remove `cucumber-java8` dependency on `cucumber-java`
4648
- To use both lambda and annotation based step definitions add a dependency on `cucumber-java` and `cucumber-java8`
@@ -72,18 +74,16 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
7274
- Adds dedicated `io.cucumber.docstring.DocString` object to use in step definitions
7375
- Adds `TypeRegistry.defineDocStringType`
7476
- Adds `@DocStringType` alternative for `TypeRegistry.defineDocStringType`
75-
76-
### Deprecated
77-
* [Core] Deprecate `timeout` ([#1506](https://github.com/cucumber/cucumber-jvm/issues/1506), [#1694](https://github.com/cucumber/cucumber-jvm/issues/1694) M.P. Korstanje)
78-
- Prefer using library based solutions
79-
* [JUnit 5 `Assertions.assertTimeout*`](https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html#assertTimeout-java.time.Duration-org.junit.jupiter.api.function.Executable-)
80-
* [Awaitility](https://github.com/awaitility/awaitility)
81-
* [Guava `TimeLimiter`](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/TimeLimiter.java)
8277

8378
### Removed
8479
- [Core] Remove deprecated tag syntax.
8580
- [Core] Remove `StepDefinitionReporter` ([#1635](https://github.com/cucumber/cucumber-jvm/issues/1635) M.P. Korstanje, Tim te Beek)
8681
- Listen `StepDefined` events instead
82+
* [Core] Remove `timeout` ([#1506](https://github.com/cucumber/cucumber-jvm/issues/1506), [#1694](https://github.com/cucumber/cucumber-jvm/issues/1694) M.P. Korstanje)
83+
- Prefer using library based solutions
84+
* [JUnit 5 `Assertions.assertTimeout*`](https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html#assertTimeout-java.time.Duration-org.junit.jupiter.api.function.Executable-)
85+
* [Awaitility](https://github.com/awaitility/awaitility)
86+
* [Guava `TimeLimiter`](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/TimeLimiter.java)
8787

8888
### Fixed
8989
- [Java8] Set default before hook order to the same after hook (1000)
@@ -171,6 +171,10 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
171171
- It is recommended to implement your own transaction hooks.
172172
- Will allow the dependency on `spring-txn` to be removed.
173173

174+
### Note
175+
Use the snapshot version of the cucumber-eclipse plugin for cucumber 4.5.0 and above that supports the new package structure. To use the latest snapshot version, refer [Follow the latest snapshot](https://github.com/cucumber/cucumber-eclipse#follow-the-latest-snapshot)
176+
177+
174178
## [4.4.0](https://github.com/cucumber/cucumber-jvm/compare/v4.3.1...v4.0.0) (2019-06-15)
175179

176180
### Added

core/pom.xml

+13-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<properties>
1515
<project.Automatic-Module-Name>io.cucumber.core</project.Automatic-Module-Name>
1616
<jsoup.version>1.12.1</jsoup.version>
17-
<xmlunit.version>1.6</xmlunit.version>
17+
<xmlunit.version>2.6.3</xmlunit.version>
1818
<webbit.version>0.4.15</webbit.version>
1919
<webbit-rest.version>0.3.0</webbit-rest.version>
2020
<hamcrest-json.version>0.2</hamcrest-json.version>
@@ -37,6 +37,10 @@
3737
<groupId>io.cucumber</groupId>
3838
<artifactId>datatable</artifactId>
3939
</dependency>
40+
<dependency>
41+
<groupId>io.cucumber</groupId>
42+
<artifactId>cucumber-plugin</artifactId>
43+
</dependency>
4044
<dependency>
4145
<groupId>io.cucumber</groupId>
4246
<artifactId>docstring</artifactId>
@@ -47,8 +51,14 @@
4751
</dependency>
4852

4953
<dependency>
50-
<groupId>xmlunit</groupId>
51-
<artifactId>xmlunit</artifactId>
54+
<groupId>org.xmlunit</groupId>
55+
<artifactId>xmlunit-core</artifactId>
56+
<version>${xmlunit.version}</version>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.xmlunit</groupId>
61+
<artifactId>xmlunit-matchers</artifactId>
5262
<version>${xmlunit.version}</version>
5363
<scope>test</scope>
5464
</dependency>

core/src/main/java/io/cucumber/core/backend/Backend.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.cucumber.core.backend;
22

3-
import io.cucumber.core.snippets.Snippet;
43
import org.apiguardian.api.API;
54

65
import java.net.URI;
@@ -20,7 +19,7 @@ public interface Backend {
2019
* Invoked before a new scenario starts. Implementations should do any necessary
2120
* setup of new, isolated state here. Additional scenario scoped step definitions
2221
* can be loaded here. These step definitions should implement
23-
* {@link io.cucumber.core.runner.ScenarioScoped}
22+
* {@link ScenarioScoped}
2423
*/
2524
void buildWorld();
2625

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package io.cucumber.core.backend;
22

3-
import io.cucumber.core.io.ResourceLoader;
43
import org.apiguardian.api.API;
54

5+
import java.util.function.Supplier;
6+
67
@API(status = API.Status.STABLE)
78
public interface BackendProviderService {
89

9-
Backend create(Lookup lookup, Container container, ResourceLoader resourceLoader);
10+
Backend create(Lookup lookup, Container container, Supplier<ClassLoader> classLoader);
1011

1112
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.cucumber.core.backend;
2+
3+
public class CucumberBackendException extends RuntimeException {
4+
5+
public CucumberBackendException(String message) {
6+
super(message);
7+
}
8+
9+
public CucumberBackendException(String message, Throwable cause) {
10+
super(message, cause);
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.cucumber.core.backend;
2+
3+
import java.lang.reflect.InvocationTargetException;
4+
5+
public class CucumberInvocationTargetException extends RuntimeException {
6+
7+
private final Located located;
8+
private final InvocationTargetException invocationTargetException;
9+
10+
public CucumberInvocationTargetException(Located located, InvocationTargetException invocationTargetException) {
11+
this.located = located;
12+
this.invocationTargetException = invocationTargetException;
13+
}
14+
15+
public Throwable getInvocationTargetExceptionCause() {
16+
return invocationTargetException.getCause();
17+
}
18+
19+
public Located getLocated() {
20+
return located;
21+
}
22+
}

core/src/main/java/io/cucumber/core/backend/DataTableTypeDefinition.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@
44
import org.apiguardian.api.API;
55

66
@API(status = API.Status.STABLE)
7-
public interface DataTableTypeDefinition {
7+
public interface DataTableTypeDefinition extends Located {
88

99
DataTableType dataTableType();
10-
11-
/**
12-
* The source line where the data table type is defined.
13-
* Example: com/example/app/Cucumber.test():42
14-
*
15-
* @param detail true if extra detailed location information should be included.
16-
* @return The source line of the step definition.
17-
*/
18-
String getLocation(boolean detail);
1910
}

core/src/main/java/io/cucumber/core/backend/DefaultDataTableCellTransformerDefinition.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,8 @@
44
import org.apiguardian.api.API;
55

66
@API(status = API.Status.STABLE)
7-
public interface DefaultDataTableCellTransformerDefinition {
7+
public interface DefaultDataTableCellTransformerDefinition extends Located {
88

99
TableCellByTypeTransformer tableCellByTypeTransformer();
1010

11-
/**
12-
* The source line where the default data table cell is defined.
13-
* Example: com/example/app/Cucumber.test():42
14-
*
15-
* @param detail true if extra detailed location information should be included.
16-
* @return The source line of the step definition.
17-
*/
18-
String getLocation(boolean detail);
19-
2011
}

core/src/main/java/io/cucumber/core/backend/DefaultDataTableEntryTransformerDefinition.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,10 @@
44
import org.apiguardian.api.API;
55

66
@API(status = API.Status.STABLE)
7-
public interface DefaultDataTableEntryTransformerDefinition {
7+
public interface DefaultDataTableEntryTransformerDefinition extends Located {
88

99
boolean headersToProperties();
1010

1111
TableEntryByTypeTransformer tableEntryByTypeTransformer();
1212

13-
/**
14-
* The source line where the default table entry transformer is defined.
15-
* Example: com/example/app/Cucumber.test():42
16-
*
17-
* @param detail true if extra detailed location information should be included.
18-
* @return The source line of the step definition.
19-
*/
20-
String getLocation(boolean detail);
2113
}

core/src/main/java/io/cucumber/core/backend/DefaultParameterTransformerDefinition.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@
44
import org.apiguardian.api.API;
55

66
@API(status = API.Status.STABLE)
7-
public interface DefaultParameterTransformerDefinition {
7+
public interface DefaultParameterTransformerDefinition extends Located{
88

99
ParameterByTypeTransformer parameterByTypeTransformer();
10-
11-
/**
12-
* The source line where the default parameter transformer is defined.
13-
* Example: com/example/app/Cucumber.test():42
14-
*
15-
* @param detail true if extra detailed location information should be included.
16-
* @return The source line of the step definition.
17-
*/
18-
String getLocation(boolean detail);
1910
}

core/src/main/java/io/cucumber/core/backend/DocStringTypeDefinition.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,8 @@
44
import org.apiguardian.api.API;
55

66
@API(status = API.Status.EXPERIMENTAL)
7-
public interface DocStringTypeDefinition {
7+
public interface DocStringTypeDefinition extends Located{
88

99
DocStringType docStringType();
1010

11-
/**
12-
* The source line where the parameter type is defined.
13-
* Example: com/example/app/Cucumber.test():42
14-
*
15-
* @param detail true if extra detailed location information should be included.
16-
* @return The source line of the step definition.
17-
*/
18-
String getLocation(boolean detail);
1911
}

core/src/main/java/io/cucumber/core/backend/HookDefinition.java

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
package io.cucumber.core.backend;
22

3-
import io.cucumber.core.api.Scenario;
43
import org.apiguardian.api.API;
54

65
@API(status = API.Status.STABLE)
7-
public interface HookDefinition {
8-
/**
9-
* The source line where the step definition is defined.
10-
* Example: foo/bar/Zap.brainfuck:42
11-
*
12-
* @param detail true if extra detailed location information should be included.
13-
* @return The source line where the step definition is defined.
14-
*/
15-
String getLocation(boolean detail);
6+
public interface HookDefinition extends Located {
167

17-
void execute(Scenario scenario) throws Throwable;
8+
void execute(TestCaseState state);
189

1910
String getTagExpression();
2011

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.cucumber.core.backend;
2+
3+
import org.apiguardian.api.API;
4+
5+
@API(status = API.Status.STABLE)
6+
public interface Located {
7+
8+
/**
9+
* @param stackTraceElement The location of the step.
10+
* @return Return true if this matches the location. This is used to filter
11+
* stack traces.
12+
*/
13+
boolean isDefinedAt(StackTraceElement stackTraceElement);
14+
15+
/**
16+
* The source line where the step definition is defined.
17+
* Example: com/example/app/Cucumber.test():42
18+
*
19+
* @return The source line of the step definition.
20+
*/
21+
String getLocation();
22+
23+
}

0 commit comments

Comments
 (0)