// Path: src/main/java/org/jembi/openhim/RestfulHttpResponse.java
// public class RestfulHttpResponse implements Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 	
// 	private String uuid = UUID.randomUUID().toString();
// 
// 	private RestfulHttpRequest originalRequest;
// 	
// 	private int httpStatus;
// 	private String body;
// 	private Map<String, Object> httpHeaders = new HashMap<String, Object>();
// 	
// 	public String getUuid() {
// 		return uuid;
// 	}
// 
// 	public void setUuid(String uuid) {
// 		this.uuid = uuid;
// 	}
// 	
// 	public RestfulHttpRequest getOriginalRequest() {
// 		return originalRequest;
// 	}
// 	
// 	public void setOriginalRequest(RestfulHttpRequest originalRequest) {
// 		this.originalRequest = originalRequest;
// 	}
// 	
// 	public int getHttpStatus() {
// 		return httpStatus;
// 	}
// 	
// 	public void setHttpStatus(int httpStatus) {
// 		this.httpStatus = httpStatus;
// 	}
// 	
// 	public String getBody() {
// 		return body;
// 	}
// 	
// 	public void setBody(String body) {
// 		this.body = body;
// 	}
// 	
// 	@Override
// 	public String toString () {
// 		StringBuffer sb = new StringBuffer();
// 
// 		sb.append("RestfulHttpResponse {\n");
// 		sb.append("	httpStatus: " + httpStatus + "\n");
// 		sb.append("	body: " + body + "\n");
// 		
// 		if (httpHeaders == null || httpHeaders.size() < 1) {
// 			sb.append("	httpHeaders: null\n");
// 		} else {
// 			sb.append("	httpHeaders: [\n");
// 			for (Object key : httpHeaders.keySet()) {
// 				Object value = httpHeaders.get(key);
// 				sb.append("		" + key + ": " + value + "\n");
// 			}
// 			sb.append("	]");
// 		}
// 
// 		sb.append("}");
// 
// 		return sb.toString();
// 	}
// 
// 	public Map<String, Object> getHttpHeaders() {
// 		return httpHeaders;
// 	}
// 
// 	public void setHttpHeaders(Map<String, Object> httpHeaders) {
// 		this.httpHeaders = httpHeaders;
// 	}
// 
// }
// 
// Path: src/main/java/org/jembi/openhim/transformers/HttpResponseToRestfulHttpResponseTransformer.java
// public class HttpResponseToRestfulHttpResponseTransformer extends
// 		AbstractMessageTransformer {
// 
// 	@Override
// 	public Object transformMessage(MuleMessage msg, String enc) throws TransformerException {
// 		
// 		RestfulHttpResponse restRes = new RestfulHttpResponse();
// 		
// 		try {
// 			int status = Integer.valueOf((String) msg.getProperty("http.status", PropertyScope.INBOUND));
// 			restRes.setHttpStatus(status);
// 			String body = msg.getPayloadAsString();
// 			restRes.setBody(body);
// 			String uuid = msg.getProperty("uuid", PropertyScope.SESSION);
// 			restRes.setUuid(uuid);
// 			restRes.setHttpHeaders((Map<String, Object>) msg.getProperty("http.headers", PropertyScope.INBOUND));
// 		} catch (Exception e) {
// 			throw new TransformerException(this, e);
// 		}
// 		
// 		return restRes;
// 	}
// 
// }


import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import org.jembi.openhim.RestfulHttpResponse;
import org.jembi.openhim.transformers.HttpResponseToRestfulHttpResponseTransformer;
import org.junit.Test;
import org.mule.api.MuleMessage;
import org.mule.api.transformer.TransformerException;
import org.mule.api.transport.PropertyScope;
		
	}
	
	/**
	 * Test transformMessage method with null uuid
	 */
	@Test
	public void testTransformMessageMuleMessageString_nullUUID() throws Exception {
		
		excecuteTestCase("200", "Test Response", null, sampleHttpHeaders);
		
	}
	
	/**
	 * Test transformMessage method with null status code
	 */
	@Test
	public void testTransformMessageMuleMessageString_nullStatusCode() throws Exception {
		
		try {
			excecuteTestCase(null, "Test Response", "d72ea800-beea-11e2-9e96-0800200c9a66", sampleHttpHeaders);
		} catch (TransformerException e) {
			// this is supposed to happen
		}
		
	}

	private void excecuteTestCase(String httpStatus, String body, String uuid, Map<String, String> httpHeaders)
			throws Exception, TransformerException {
		setupMocks(httpStatus, body, uuid, httpHeaders);
// Path: src/main/java/org/jembi/openhim/RestfulHttpResponse.java
// public class RestfulHttpResponse implements Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 	
// 	private String uuid = UUID.randomUUID().toString();
// 
// 	private RestfulHttpRequest originalRequest;
// 	
// 	private int httpStatus;
// 	private String body;
// 	private Map<String, Object> httpHeaders = new HashMap<String, Object>();
// 	
// 	public String getUuid() {
// 		return uuid;
// 	}
// 
// 	public void setUuid(String uuid) {
// 		this.uuid = uuid;
// 	}
// 	
// 	public RestfulHttpRequest getOriginalRequest() {
// 		return originalRequest;
// 	}
// 	
// 	public void setOriginalRequest(RestfulHttpRequest originalRequest) {
// 		this.originalRequest = originalRequest;
// 	}
// 	
// 	public int getHttpStatus() {
// 		return httpStatus;
// 	}
// 	
// 	public void setHttpStatus(int httpStatus) {
// 		this.httpStatus = httpStatus;
// 	}
// 	
// 	public String getBody() {
// 		return body;
// 	}
// 	
// 	public void setBody(String body) {
// 		this.body = body;
// 	}
// 	
// 	@Override
// 	public String toString () {
// 		StringBuffer sb = new StringBuffer();
// 
// 		sb.append("RestfulHttpResponse {\n");
// 		sb.append("	httpStatus: " + httpStatus + "\n");
// 		sb.append("	body: " + body + "\n");
// 		
// 		if (httpHeaders == null || httpHeaders.size() < 1) {
// 			sb.append("	httpHeaders: null\n");
// 		} else {
// 			sb.append("	httpHeaders: [\n");
// 			for (Object key : httpHeaders.keySet()) {
// 				Object value = httpHeaders.get(key);
// 				sb.append("		" + key + ": " + value + "\n");
// 			}
// 			sb.append("	]");
// 		}
// 
// 		sb.append("}");
// 
// 		return sb.toString();
// 	}
// 
// 	public Map<String, Object> getHttpHeaders() {
// 		return httpHeaders;
// 	}
// 
// 	public void setHttpHeaders(Map<String, Object> httpHeaders) {
// 		this.httpHeaders = httpHeaders;
// 	}
// 
// }
// 
// Path: src/main/java/org/jembi/openhim/transformers/HttpResponseToRestfulHttpResponseTransformer.java
// public class HttpResponseToRestfulHttpResponseTransformer extends
// 		AbstractMessageTransformer {
// 
// 	@Override
// 	public Object transformMessage(MuleMessage msg, String enc) throws TransformerException {
// 		
// 		RestfulHttpResponse restRes = new RestfulHttpResponse();
// 		
// 		try {
// 			int status = Integer.valueOf((String) msg.getProperty("http.status", PropertyScope.INBOUND));
// 			restRes.setHttpStatus(status);
// 			String body = msg.getPayloadAsString();
// 			restRes.setBody(body);
// 			String uuid = msg.getProperty("uuid", PropertyScope.SESSION);
// 			restRes.setUuid(uuid);
// 			restRes.setHttpHeaders((Map<String, Object>) msg.getProperty("http.headers", PropertyScope.INBOUND));
// 		} catch (Exception e) {
// 			throw new TransformerException(this, e);
// 		}
// 		
// 		return restRes;
// 	}
// 
// }


// Path: src/test/java/org/jembi/openhim/transformers/HttpResponseToRestfulHttpResponseTransformerTest.java
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import org.jembi.openhim.RestfulHttpResponse;
import org.jembi.openhim.transformers.HttpResponseToRestfulHttpResponseTransformer;
import org.junit.Test;
import org.mule.api.MuleMessage;
import org.mule.api.transformer.TransformerException;
import org.mule.api.transport.PropertyScope;

		
	}
	
	/**
	 * Test transformMessage method with null uuid
	 */
	@Test
	public void testTransformMessageMuleMessageString_nullUUID() throws Exception {
		
		excecuteTestCase("200", "Test Response", null, sampleHttpHeaders);
		
	}
	
	/**
	 * Test transformMessage method with null status code
	 */
	@Test
	public void testTransformMessageMuleMessageString_nullStatusCode() throws Exception {
		
		try {
			excecuteTestCase(null, "Test Response", "d72ea800-beea-11e2-9e96-0800200c9a66", sampleHttpHeaders);
		} catch (TransformerException e) {
			// this is supposed to happen
		}
		
	}

	private void excecuteTestCase(String httpStatus, String body, String uuid, Map<String, String> httpHeaders)
			throws Exception, TransformerException {
		setupMocks(httpStatus, body, uuid, httpHeaders);
		HttpResponseToRestfulHttpResponseTransformer trans = new HttpResponseToRestfulHttpResponseTransformer();