001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.mock;
014
015import org.apache.http.*;
016import org.apache.juneau.internal.*;
017import org.apache.juneau.parser.*;
018import org.apache.juneau.rest.client.*;
019
020/**
021 * A subclass of {@link RestResponse} with additional features for mocked testing.
022 *
023 * <h5 class='section'>See Also:</h5><ul>
024 *    <li class='link'><a class="doclink" href="../../../../../index.html#juneau-rest-mock">juneau-rest-mock</a>
025 * </ul>
026*/
027@FluentSetters
028public class MockRestResponse extends org.apache.juneau.rest.client.RestResponse {
029
030   /**
031    * Constructor.
032    *
033    * @param client The RestClient that created this response.
034    * @param request The REST request.
035    * @param response The HTTP response.  Can be <jk>null</jk>.
036    * @param parser The overridden parser passed into {@link RestRequest#parser(Parser)}.
037    */
038   public MockRestResponse(RestClient client, RestRequest request, HttpResponse response, Parser parser) {
039      super(client, request, response, parser);
040      ((MockRestClient)client).currentResponse(this);
041   }
042
043   // <FluentSetters>
044
045   @Override /* GENERATED - org.apache.juneau.rest.client.RestResponse */
046   public MockRestResponse cacheContent() {
047      super.cacheContent();
048      return this;
049   }
050
051   @Override /* GENERATED - org.apache.juneau.rest.client.RestResponse */
052   public MockRestResponse consume() throws RestCallException{
053      super.consume();
054      return this;
055   }
056
057   // </FluentSetters>
058}