@@ -81,9 +81,22 @@ void doBuildWithParameters_shouldFailWhenInvokingDisabledProject() throws Except
81
81
82
82
FailingHttpStatusCodeException fex = assertThrows (
83
83
FailingHttpStatusCodeException .class ,
84
- () -> webClient .getPage (webClient .addCrumb (new WebRequest (new URL (j .getURL (), project .getUrl () + "build?delay=0 " ), HttpMethod .POST ))),
84
+ () -> webClient .getPage (webClient .addCrumb (new WebRequest (new URL (j .getURL (), project .getUrl () + "buildWithParameters?FOO=x " ), HttpMethod .POST ))),
85
85
"should fail when invoking disabled project" );
86
- assertThat ("Should fail with conflict" , fex .getStatusCode (), is (409 ));
86
+ assertThat ("Should fail with conflict" , fex .getStatusCode (), is (HttpServletResponse .SC_CONFLICT ));
87
+ }
88
+
89
+ @ Test
90
+ void doBuildWithParameters_shouldFailWhenInvokingNonParameterizedProject () throws Exception {
91
+ final FreeStyleProject project = j .createFreeStyleProject ();
92
+
93
+ final JenkinsRule .WebClient webClient = j .createWebClient ();
94
+
95
+ FailingHttpStatusCodeException fex = assertThrows (
96
+ FailingHttpStatusCodeException .class ,
97
+ () -> webClient .getPage (webClient .addCrumb (new WebRequest (new URL (j .getURL (), project .getUrl () + "buildWithParameters?FOO=x" ), HttpMethod .POST ))),
98
+ "should fail when invoking non-parameterized project" );
99
+ assertThat ("Should fail with bad request" , fex .getStatusCode (), is (HttpServletResponse .SC_BAD_REQUEST ));
87
100
}
88
101
89
102
@ Test
0 commit comments