Clover coverage report - Diasparsoft Toolkit - 0.22
Coverage timestamp: Tue Jun 8 2004 12:41:26 EDT
file stats: LOC: 66   Methods: 9
NCLOC: 51   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
InputStreamWebResponse.java 100% 94.1% 88.9% 92.9%
coverage coverage
 1   
 package com.diasparsoftware.htmlunitx;
 2   
 
 3   
 import java.io.*;
 4   
 import java.net.URL;
 5   
 
 6   
 import com.diasparsoftware.gsbase.StreamUtil;
 7   
 
 8   
 public class InputStreamWebResponse extends TestableWebResponse {
 9   
     private InputStream contentAsStream;
 10   
 
 11  396
     public InputStreamWebResponse(URL url,
 12   
         InputStream contentAsStream) {
 13   
 
 14  396
         super(url);
 15   
 
 16  396
         this.contentAsStream = contentAsStream;
 17   
     }
 18   
 
 19  44
     public String getContentAsString() throws IOException {
 20  44
         return StreamUtil
 21   
             .getContentAsString(getContentAsStream());
 22   
     }
 23   
 
 24  374
     public InputStream getContentAsStream() {
 25  374
         getStopwatch().start();
 26  374
         getStopwatch().stop();
 27  374
         return contentAsStream;
 28   
     }
 29   
 
 30  22
     public long getLoadTimeInMilliSeconds() {
 31  22
         return getStopwatch().getLastTime();
 32   
     }
 33   
 
 34  33
     public byte[] getResponseBody() {
 35  33
         try {
 36  33
             return getContentAsBytes();
 37   
         } catch (IOException wrapped) {
 38  11
             throw new RuntimeException(wrapped);
 39   
         }
 40   
     }
 41   
 
 42  22
     protected byte[] getContentAsBytes()
 43   
         throws UnsupportedEncodingException, IOException {
 44  22
         return getContentAsString().getBytes(
 45   
             getContentCharSet());
 46   
     }
 47   
 
 48  220
     public boolean equals(Object other) {
 49  220
         if (other != null && getClass() == other.getClass()) {
 50  154
             InputStreamWebResponse that = (InputStreamWebResponse) other;
 51  154
             return this.getUrl().equals(that.getUrl()) && this
 52   
                 .getContentAsStream().equals(
 53   
                     that.getContentAsStream());
 54   
         } else {
 55  66
             return false;
 56   
         }
 57   
     }
 58   
 
 59  44
     public int hashCode() {
 60  44
         return 0;
 61   
     }
 62   
 
 63  0
     public String toString() {
 64  0
         return "an InputStreamWebResponse[contentAsStream=" + contentAsStream + "]";
 65   
     }
 66   
 }