提交 57e6e088 编写于 作者: S Sam Brannen

Introduce isExecuted() in MockClientHttpRequest

This commit introduces the missing isExecuted() method in
MockClientHttpRequest and improves the documentation for execute()
and executeInternal().
上级 a3e4f6ca
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.mock.http.client;
import java.io.IOException;
......@@ -27,6 +28,7 @@ import org.springframework.mock.http.MockHttpOutputMessage;
* Mock implementation of {@link ClientHttpRequest}.
*
* @author Rossen Stoyanchev
* @author Sam Brannen
* @since 3.2
*/
public class MockClientHttpRequest extends MockHttpOutputMessage implements ClientHttpRequest {
......@@ -74,9 +76,14 @@ public class MockClientHttpRequest extends MockHttpOutputMessage implements Clie
this.clientHttpResponse = clientHttpResponse;
}
public boolean isExecuted() {
return this.executed;
}
/**
* Sets the {@link #isExecuted() executed} flag to true and returns the
* Set the {@link #isExecuted() executed} flag to {@code true} and return the
* configured {@link #setResponse(ClientHttpResponse) response}.
* @see #executeInternal()
*/
public final ClientHttpResponse execute() throws IOException {
this.executed = true;
......@@ -84,7 +91,11 @@ public class MockClientHttpRequest extends MockHttpOutputMessage implements Clie
}
/**
* Override this method to execute the request and provdie a response.
* The default implementation returns the configured
* {@link #setResponse(ClientHttpResponse) response}.
*
* <p>Override this method to execute the request and provide a response,
* potentially different than the configured response.
*/
protected ClientHttpResponse executeInternal() throws IOException {
return this.clientHttpResponse;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册