Skip to content

Commit d43a51f

Browse files
committed
Merge #1208 'Reduce Throwable to Exception in JavaSnippet'
2 parents 0ea7b43 + 7873cb5 commit d43a51f

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
22

33
## [2.0.0-SNAPSHOT](https://github.com/cucumber/cucumber-jvm/compare/v1.2.5...master) (In Git)
44

5+
* [Java] Reduce Throwable to Exception in JavaSnippet ([#1207](https://github.com/cucumber/cucumber-jvm/issues/1207), [#1208](https://github.com/cucumber/cucumber-jvm/pull/1208) M.P. Korstanje)
56
* [Core] Update the cucumber-html dependency to version 0.2.6 (Björn Rasmusson)
67
* [Core] Fix PrettyFormatter exception on nested arguments ([#1200](https://github.com/cucumber/cucumber-jvm/pull/1200) Marit van Dijk, M.P. Korstanje)
78
* [Core] Added tests for diffing with empty table and list ([#1194](https://github.com/cucumber/cucumber-jvm/pull/1194) Marit van Dijk, M.P. Korstanje)

java/src/main/java/cucumber/runtime/java/JavaSnippet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ protected String getArgType(Class<?> argType) {
1010
@Override
1111
public String template() {
1212
return "@{0}(\"{1}\")\n" +
13-
"public void {2}({3}) throws Throwable '{'\n" +
13+
"public void {2}({3}) throws Exception '{'\n" +
1414
" // {4}\n" +
1515
"{5} throw new PendingException();\n" +
1616
"'}'\n";

java/src/test/java/cucumber/runtime/java/JavaSnippetTest.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class JavaSnippetTest {
2727
public void generatesPlainSnippet() {
2828
String expected = "" +
2929
"@Given(\"^I have (\\\\d+) cukes in my \\\"([^\\\"]*)\\\" belly$\")\n" +
30-
"public void i_have_cukes_in_my_belly(int arg1, String arg2) throws Throwable {\n" +
30+
"public void i_have_cukes_in_my_belly(int arg1, String arg2) throws Exception {\n" +
3131
" // Write code here that turns the phrase above into concrete actions\n" +
3232
" throw new PendingException();\n" +
3333
"}\n";
@@ -38,7 +38,7 @@ public void generatesPlainSnippet() {
3838
public void generatesCopyPasteReadyStepSnippetForNumberParameters() throws Exception {
3939
String expected = "" +
4040
"@Given(\"^before (\\\\d+) after$\")\n" +
41-
"public void before_after(int arg1) throws Throwable {\n" +
41+
"public void before_after(int arg1) throws Exception {\n" +
4242
" // Write code here that turns the phrase above into concrete actions\n" +
4343
" throw new PendingException();\n" +
4444
"}\n";
@@ -50,7 +50,7 @@ public void generatesCopyPasteReadyStepSnippetForNumberParameters() throws Excep
5050
public void generatesCopyPasteReadySnippetWhenStepHasIllegalJavaIdentifierChars() {
5151
String expected = "" +
5252
"@Given(\"^I have (\\\\d+) cukes in: my \\\"([^\\\"]*)\\\" red-belly!$\")\n" +
53-
"public void i_have_cukes_in_my_red_belly(int arg1, String arg2) throws Throwable {\n" +
53+
"public void i_have_cukes_in_my_red_belly(int arg1, String arg2) throws Exception {\n" +
5454
" // Write code here that turns the phrase above into concrete actions\n" +
5555
" throw new PendingException();\n" +
5656
"}\n";
@@ -61,7 +61,7 @@ public void generatesCopyPasteReadySnippetWhenStepHasIllegalJavaIdentifierChars(
6161
public void generatesCopyPasteReadySnippetWhenStepHasIntegersInsideStringParameter() {
6262
String expected = "" +
6363
"@Given(\"^the DI system receives a message saying \\\"([^\\\"]*)\\\"$\")\n" +
64-
"public void the_DI_system_receives_a_message_saying(String arg1) throws Throwable {\n" +
64+
"public void the_DI_system_receives_a_message_saying(String arg1) throws Exception {\n" +
6565
" // Write code here that turns the phrase above into concrete actions\n" +
6666
" throw new PendingException();\n" +
6767
"}\n";
@@ -72,7 +72,7 @@ public void generatesCopyPasteReadySnippetWhenStepHasIntegersInsideStringParamet
7272
public void generatesSnippetWithEscapedDollarSigns() {
7373
String expected = "" +
7474
"@Given(\"^I have \\\\$(\\\\d+)$\")\n" +
75-
"public void i_have_$(int arg1) throws Throwable {\n" +
75+
"public void i_have_$(int arg1) throws Exception {\n" +
7676
" // Write code here that turns the phrase above into concrete actions\n" +
7777
" throw new PendingException();\n" +
7878
"}\n";
@@ -83,7 +83,7 @@ public void generatesSnippetWithEscapedDollarSigns() {
8383
public void generatesSnippetWithEscapedQuestionMarks() {
8484
String expected = "" +
8585
"@Given(\"^is there an error\\\\?:$\")\n" +
86-
"public void is_there_an_error() throws Throwable {\n" +
86+
"public void is_there_an_error() throws Exception {\n" +
8787
" // Write code here that turns the phrase above into concrete actions\n" +
8888
" throw new PendingException();\n" +
8989
"}\n";
@@ -94,7 +94,7 @@ public void generatesSnippetWithEscapedQuestionMarks() {
9494
public void generatesSnippetWithLotsOfEscapes() {
9595
String expected = "" +
9696
"@Given(\"^\\\\^\\\\(\\\\[a-z\\\\]\\\\*\\\\)\\\\?\\\\.\\\\+\\\\$$\")\n" +
97-
"public void a_z_$() throws Throwable {\n" +
97+
"public void a_z_$() throws Exception {\n" +
9898
" // Write code here that turns the phrase above into concrete actions\n" +
9999
" throw new PendingException();\n" +
100100
"}\n";
@@ -105,7 +105,7 @@ public void generatesSnippetWithLotsOfEscapes() {
105105
public void generatesSnippetWithEscapedParentheses() {
106106
String expected = "" +
107107
"@Given(\"^I have (\\\\d+) cukes \\\\(maybe more\\\\)$\")\n" +
108-
"public void i_have_cukes_maybe_more(int arg1) throws Throwable {\n" +
108+
"public void i_have_cukes_maybe_more(int arg1) throws Exception {\n" +
109109
" // Write code here that turns the phrase above into concrete actions\n" +
110110
" throw new PendingException();\n" +
111111
"}\n";
@@ -116,7 +116,7 @@ public void generatesSnippetWithEscapedParentheses() {
116116
public void generatesSnippetWithEscapedBrackets() {
117117
String expected = "" +
118118
"@Given(\"^I have (\\\\d+) cukes \\\\[maybe more\\\\]$\")\n" +
119-
"public void i_have_cukes_maybe_more(int arg1) throws Throwable {\n" +
119+
"public void i_have_cukes_maybe_more(int arg1) throws Exception {\n" +
120120
" // Write code here that turns the phrase above into concrete actions\n" +
121121
" throw new PendingException();\n" +
122122
"}\n";
@@ -127,7 +127,7 @@ public void generatesSnippetWithEscapedBrackets() {
127127
public void generatesSnippetWithDocString() {
128128
String expected = "" +
129129
"@Given(\"^I have:$\")\n" +
130-
"public void i_have(String arg1) throws Throwable {\n" +
130+
"public void i_have(String arg1) throws Exception {\n" +
131131
" // Write code here that turns the phrase above into concrete actions\n" +
132132
" throw new PendingException();\n" +
133133
"}\n";
@@ -139,7 +139,7 @@ public void generatesSnippetWithDocString() {
139139
public void recognisesWordWithNumbers() {
140140
String expected = "" +
141141
"@Given(\"^Then it responds ([^\\\"]*)$\")\n" +
142-
"public void Then_it_responds(String arg1) throws Throwable {\n" +
142+
"public void Then_it_responds(String arg1) throws Exception {\n" +
143143
" // Write code here that turns the phrase above into concrete actions\n" +
144144
"}\n";
145145
assertEquals(expected, snippetFor("Then it responds UTF-8"));
@@ -149,7 +149,7 @@ public void recognisesWordWithNumbers() {
149149
public void generatesSnippetWithDataTable() {
150150
String expected = "" +
151151
"@Given(\"^I have:$\")\n" +
152-
"public void i_have(DataTable arg1) throws Throwable {\n" +
152+
"public void i_have(DataTable arg1) throws Exception {\n" +
153153
" // Write code here that turns the phrase above into concrete actions\n" +
154154
" // For automatic transformation, change DataTable to one of\n" +
155155
" // List<YourType>, List<List<E>>, List<Map<K,V>> or Map<K,V>.\n" +
@@ -164,7 +164,7 @@ public void generatesSnippetWithDataTable() {
164164
public void generateSnippetWithOutlineParam() {
165165
String expected = "" +
166166
"@Given(\"^Then it responds (.*)$\")\n" +
167-
"public void then_it_responds(String arg1) throws Throwable {\n" +
167+
"public void then_it_responds(String arg1) throws Exception {\n" +
168168
" // Write code here that turns the phrase above into concrete actions\n" +
169169
" throw new PendingException();\n" +
170170
"}\n";

0 commit comments

Comments
 (0)