diff --git a/java/src/main/java/cucumber/runtime/java/JavaSnippet.java b/java/src/main/java/cucumber/runtime/java/JavaSnippet.java index a8950b5b31..1cd4f4e677 100644 --- a/java/src/main/java/cucumber/runtime/java/JavaSnippet.java +++ b/java/src/main/java/cucumber/runtime/java/JavaSnippet.java @@ -10,7 +10,7 @@ protected String getArgType(Class argType) { @Override public String template() { return "@{0}(\"{1}\")\n" + - "public void {2}({3}) throws Throwable '{'\n" + + "public void {2}({3}) throws Exception '{'\n" + " // {4}\n" + "{5} throw new PendingException();\n" + "'}'\n"; diff --git a/java/src/test/java/cucumber/runtime/java/JavaSnippetTest.java b/java/src/test/java/cucumber/runtime/java/JavaSnippetTest.java index caac83cd0a..53440e30fc 100644 --- a/java/src/test/java/cucumber/runtime/java/JavaSnippetTest.java +++ b/java/src/test/java/cucumber/runtime/java/JavaSnippetTest.java @@ -27,7 +27,7 @@ public class JavaSnippetTest { public void generatesPlainSnippet() { String expected = "" + "@Given(\"^I have (\\\\d+) cukes in my \\\"([^\\\"]*)\\\" belly$\")\n" + - "public void i_have_cukes_in_my_belly(int arg1, String arg2) throws Throwable {\n" + + "public void i_have_cukes_in_my_belly(int arg1, String arg2) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -38,7 +38,7 @@ public void generatesPlainSnippet() { public void generatesCopyPasteReadyStepSnippetForNumberParameters() throws Exception { String expected = "" + "@Given(\"^before (\\\\d+) after$\")\n" + - "public void before_after(int arg1) throws Throwable {\n" + + "public void before_after(int arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -50,7 +50,7 @@ public void generatesCopyPasteReadyStepSnippetForNumberParameters() throws Excep public void generatesCopyPasteReadySnippetWhenStepHasIllegalJavaIdentifierChars() { String expected = "" + "@Given(\"^I have (\\\\d+) cukes in: my \\\"([^\\\"]*)\\\" red-belly!$\")\n" + - "public void i_have_cukes_in_my_red_belly(int arg1, String arg2) throws Throwable {\n" + + "public void i_have_cukes_in_my_red_belly(int arg1, String arg2) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -61,7 +61,7 @@ public void generatesCopyPasteReadySnippetWhenStepHasIllegalJavaIdentifierChars( public void generatesCopyPasteReadySnippetWhenStepHasIntegersInsideStringParameter() { String expected = "" + "@Given(\"^the DI system receives a message saying \\\"([^\\\"]*)\\\"$\")\n" + - "public void the_DI_system_receives_a_message_saying(String arg1) throws Throwable {\n" + + "public void the_DI_system_receives_a_message_saying(String arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -72,7 +72,7 @@ public void generatesCopyPasteReadySnippetWhenStepHasIntegersInsideStringParamet public void generatesSnippetWithEscapedDollarSigns() { String expected = "" + "@Given(\"^I have \\\\$(\\\\d+)$\")\n" + - "public void i_have_$(int arg1) throws Throwable {\n" + + "public void i_have_$(int arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -83,7 +83,7 @@ public void generatesSnippetWithEscapedDollarSigns() { public void generatesSnippetWithEscapedQuestionMarks() { String expected = "" + "@Given(\"^is there an error\\\\?:$\")\n" + - "public void is_there_an_error() throws Throwable {\n" + + "public void is_there_an_error() throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -94,7 +94,7 @@ public void generatesSnippetWithEscapedQuestionMarks() { public void generatesSnippetWithLotsOfEscapes() { String expected = "" + "@Given(\"^\\\\^\\\\(\\\\[a-z\\\\]\\\\*\\\\)\\\\?\\\\.\\\\+\\\\$$\")\n" + - "public void a_z_$() throws Throwable {\n" + + "public void a_z_$() throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -105,7 +105,7 @@ public void generatesSnippetWithLotsOfEscapes() { public void generatesSnippetWithEscapedParentheses() { String expected = "" + "@Given(\"^I have (\\\\d+) cukes \\\\(maybe more\\\\)$\")\n" + - "public void i_have_cukes_maybe_more(int arg1) throws Throwable {\n" + + "public void i_have_cukes_maybe_more(int arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -116,7 +116,7 @@ public void generatesSnippetWithEscapedParentheses() { public void generatesSnippetWithEscapedBrackets() { String expected = "" + "@Given(\"^I have (\\\\d+) cukes \\\\[maybe more\\\\]$\")\n" + - "public void i_have_cukes_maybe_more(int arg1) throws Throwable {\n" + + "public void i_have_cukes_maybe_more(int arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -127,7 +127,7 @@ public void generatesSnippetWithEscapedBrackets() { public void generatesSnippetWithDocString() { String expected = "" + "@Given(\"^I have:$\")\n" + - "public void i_have(String arg1) throws Throwable {\n" + + "public void i_have(String arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n"; @@ -139,7 +139,7 @@ public void generatesSnippetWithDocString() { public void recognisesWordWithNumbers() { String expected = "" + "@Given(\"^Then it responds ([^\\\"]*)$\")\n" + - "public void Then_it_responds(String arg1) throws Throwable {\n" + + "public void Then_it_responds(String arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + "}\n"; assertEquals(expected, snippetFor("Then it responds UTF-8")); @@ -149,7 +149,7 @@ public void recognisesWordWithNumbers() { public void generatesSnippetWithDataTable() { String expected = "" + "@Given(\"^I have:$\")\n" + - "public void i_have(DataTable arg1) throws Throwable {\n" + + "public void i_have(DataTable arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " // For automatic transformation, change DataTable to one of\n" + " // List, List>, List> or Map.\n" + @@ -164,7 +164,7 @@ public void generatesSnippetWithDataTable() { public void generateSnippetWithOutlineParam() { String expected = "" + "@Given(\"^Then it responds (.*)$\")\n" + - "public void then_it_responds(String arg1) throws Throwable {\n" + + "public void then_it_responds(String arg1) throws Exception {\n" + " // Write code here that turns the phrase above into concrete actions\n" + " throw new PendingException();\n" + "}\n";