Coverage Report - ca.uhn.hl7v2.hoh.raw.api.RawSendable
 
Classes in this File Line Coverage Branch Coverage Complexity
RawSendable
80%
12/15
50%
2/4
1.6
 
 1  
 package ca.uhn.hl7v2.hoh.raw.api;
 2  
 
 3  
 import java.io.IOException;
 4  
 import java.io.Writer;
 5  
 
 6  
 import ca.uhn.hl7v2.hoh.api.IResponseSendable;
 7  
 import ca.uhn.hl7v2.hoh.encoder.EncodingStyle;
 8  
 import ca.uhn.hl7v2.hoh.encoder.ResponseCode;
 9  
 
 10  0
 public class RawSendable implements IResponseSendable<String> {
 11  
 
 12  
         private final String myRawMessage;
 13  
         private final EncodingStyle myEncodingStyle;
 14  
         private ResponseCode myResponseCode;
 15  
 
 16  
         /**
 17  
          * Constructor
 18  
          * 
 19  
          * @param theRawMessage
 20  
          *            The message to return
 21  
          */
 22  145
         public RawSendable(String theRawMessage) {
 23  145
                 if (theRawMessage == null) {
 24  0
                         throw new NullPointerException("Raw Message may not be null");
 25  
                 }
 26  145
                 myRawMessage = theRawMessage;
 27  145
                 myEncodingStyle = EncodingStyle.detect(myRawMessage);
 28  145
         }
 29  
 
 30  
         public void writeMessage(Writer theWriter) throws IOException {
 31  145
                 theWriter.write(myRawMessage);
 32  145
                 theWriter.flush();
 33  145
         }
 34  
 
 35  
         public EncodingStyle getEncodingStyle() {
 36  145
                 return myEncodingStyle;
 37  
         }
 38  
 
 39  
         public ResponseCode getResponseCode() {
 40  50
                 if (myResponseCode == null) {
 41  50
                         myResponseCode = ResponseCode.detect(myRawMessage);
 42  
                 }
 43  50
                 return myResponseCode;
 44  
         }
 45  
 
 46  
         public String getMessage() {
 47  0
                 return myRawMessage;
 48  
         }
 49  
 
 50  
 }