2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

Coverage Report - org.apache.shale.test.mock.MockExternalContext12
 
Classes in this File Line Coverage Branch Coverage Complexity
MockExternalContext12
100%
2/2
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to you under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.shale.test.mock;
 19  
 
 20  
 import java.io.UnsupportedEncodingException;
 21  
 import javax.servlet.ServletContext;
 22  
 import javax.servlet.http.HttpServletRequest;
 23  
 import javax.servlet.http.HttpServletResponse;
 24  
 
 25  
 /**
 26  
  * <p>Mock implementation of <code>ExternalContext</code> that includes the semantics
 27  
  * added by JavaServer Faces 1.2.</p>
 28  
  *
 29  
  * $Id: MockExternalContext12.java 464373 2006-10-16 04:21:54Z rahul $
 30  
  *
 31  
  * @since 1.0.4
 32  
  */
 33  
 
 34  
 public class MockExternalContext12 extends MockExternalContext {
 35  
 
 36  
 
 37  
     // ------------------------------------------------------------ Constructors
 38  
 
 39  
 
 40  
     public MockExternalContext12(ServletContext context,
 41  
                                  HttpServletRequest request,
 42  
                                  HttpServletResponse response) {
 43  18
         super(context, request, response);
 44  18
     }
 45  
 
 46  
 
 47  
     // ------------------------------------------------------ Instance Variables
 48  
 
 49  
 
 50  
     // ----------------------------------------------------- Mock Object Methods
 51  
 
 52  
 
 53  
     // ------------------------------------------------- ExternalContext Methods
 54  
 
 55  
 
 56  
     /** {@inheritDoc} */
 57  
     public String getRequestCharacterEncoding() {
 58  
 
 59  
         return this.request.getCharacterEncoding();
 60  
 
 61  
     }
 62  
 
 63  
 
 64  
     /** {@inheritDoc} */
 65  
     public String getRequestContentType() {
 66  
 
 67  
         return this.request.getContentType();
 68  
 
 69  
     }
 70  
 
 71  
 
 72  
     /** {@inheritDoc} */
 73  
     public String getResponseCharacterEncoding() {
 74  
 
 75  
         return this.response.getCharacterEncoding();
 76  
 
 77  
     }
 78  
 
 79  
 
 80  
     /** {@inheritDoc} */
 81  
     public String getResponseContentType() {
 82  
 
 83  
         return this.response.getContentType();
 84  
 
 85  
     }
 86  
 
 87  
 
 88  
     /** {@inheritDoc} */
 89  
     public void setRequest(Object request) {
 90  
 
 91  
         this.request = (HttpServletRequest) request;
 92  
 
 93  
     }
 94  
 
 95  
 
 96  
     /** {@inheritDoc} */
 97  
     public void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException {
 98  
 
 99  
         this.request.setCharacterEncoding(encoding);
 100  
 
 101  
     }
 102  
 
 103  
 
 104  
     /** {@inheritDoc} */
 105  
     public void setResponse(Object response) {
 106  
 
 107  
         this.response = (HttpServletResponse) response;
 108  
 
 109  
     }
 110  
 
 111  
 
 112  
     /** {@inheritDoc} */
 113  
     public void setResponseCharacterEncoding(String encoding) {
 114  
 
 115  
         this.response.setCharacterEncoding(encoding);
 116  
 
 117  
     }
 118  
 
 119  
 
 120  
 }