// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static GetDatastream getDatastream(String pid, String dsId) {
//     return new GetDatastream(pid, dsId);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClientException.java
// public class FedoraClientException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private int status;
// 
//     public FedoraClientException(String message) {
//         super(message, null);
//     }
// 
//     public FedoraClientException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     /**
//      *
//      * @param status the HTTP status code of the error.
//      * @param message
//      */
//     public FedoraClientException(int status, String message) {
//         super(message);
//         this.status = status;
//     }
// 
//     /**
//      *
//      * @return the HTTP status code of the error
//      */
//     public int getStatus() {
//         return status;
//     }
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/FedoraResponse.java
// public interface FedoraResponse {
// 
//     /**
//      *
//      * @return the HTTP Status Code of the response.
//      */
//     public int getStatus();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public InputStream getEntityInputStream();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public <T> T getEntity(Class<T> c);
// 
//     /**
//      * <p>Get the media type of the response;
//      * @return the media type.
//      */
//     public String getType();
// 
//     /**
//      * <p>Close the response.
//      * <p>The entity input stream is closed;
//      */
//     public void close();
// 
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/GetDatastreamResponse.java
// public class GetDatastreamResponse extends DatastreamProfileResponse {
// 
//     public GetDatastreamResponse(ClientResponse cr)
//             throws FedoraClientException {
//         super(cr);
//     }
// }


import com.yourmediashelf.fedora.client.response.FedoraResponse;
import com.yourmediashelf.fedora.client.response.GetDatastreamResponse;
import com.yourmediashelf.fedora.generated.management.DatastreamProfile;
import static com.yourmediashelf.fedora.client.FedoraClient.getDatastream;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import static org.junit.Assert.assertEquals;
import org.custommonkey.xmlunit.HTMLDocumentBuilder;
import org.custommonkey.xmlunit.TolerantSaxDocumentBuilder;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
import com.yourmediashelf.fedora.client.FedoraClientException;
    public void testGetDatastreamAsXml() throws Exception {
        GetDatastreamResponse response = null;

        response = getDatastream(testPid, "DC").format("xml").execute();
        assertEquals(200, response.getStatus());

        DatastreamProfile profile = response.getDatastreamProfile();
        assertEquals(testPid, profile.getPid());
        assertEquals("DC", profile.getDsID());
    }

    @Test
    public void testGetDatastreamAsOfDateTimeAsXML() throws Exception {
        GetDatastreamResponse response = null;

        response =
                getDatastream(testPid, "DC").format("xml").asOfDateTime(
                        "9999-01-01T00:01:04.567Z").execute();
        DatastreamProfile profile = response.getDatastreamProfile();
        assertEquals(testPid, profile.getPid());
        assertEquals("DC", profile.getDsID());
    }

    /**
     * Test retrieving the dsState of a datastream.
     *
     * @throws Exception
     */
    @Test
    public void testGetDatastreamState() throws Exception {
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static GetDatastream getDatastream(String pid, String dsId) {
//     return new GetDatastream(pid, dsId);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClientException.java
// public class FedoraClientException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private int status;
// 
//     public FedoraClientException(String message) {
//         super(message, null);
//     }
// 
//     public FedoraClientException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     /**
//      *
//      * @param status the HTTP status code of the error.
//      * @param message
//      */
//     public FedoraClientException(int status, String message) {
//         super(message);
//         this.status = status;
//     }
// 
//     /**
//      *
//      * @return the HTTP status code of the error
//      */
//     public int getStatus() {
//         return status;
//     }
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/FedoraResponse.java
// public interface FedoraResponse {
// 
//     /**
//      *
//      * @return the HTTP Status Code of the response.
//      */
//     public int getStatus();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public InputStream getEntityInputStream();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public <T> T getEntity(Class<T> c);
// 
//     /**
//      * <p>Get the media type of the response;
//      * @return the media type.
//      */
//     public String getType();
// 
//     /**
//      * <p>Close the response.
//      * <p>The entity input stream is closed;
//      */
//     public void close();
// 
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/GetDatastreamResponse.java
// public class GetDatastreamResponse extends DatastreamProfileResponse {
// 
//     public GetDatastreamResponse(ClientResponse cr)
//             throws FedoraClientException {
//         super(cr);
//     }
// }


// Path: fedora-client-core/src/test/java/com/yourmediashelf/fedora/client/request/GetDatastreamIT.java
import com.yourmediashelf.fedora.client.response.FedoraResponse;
import com.yourmediashelf.fedora.client.response.GetDatastreamResponse;
import com.yourmediashelf.fedora.generated.management.DatastreamProfile;
import static com.yourmediashelf.fedora.client.FedoraClient.getDatastream;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import static org.junit.Assert.assertEquals;
import org.custommonkey.xmlunit.HTMLDocumentBuilder;
import org.custommonkey.xmlunit.TolerantSaxDocumentBuilder;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.w3c.dom.Document;
import com.yourmediashelf.fedora.client.FedoraClientException;

    public void testGetDatastreamAsXml() throws Exception {
        GetDatastreamResponse response = null;

        response = getDatastream(testPid, "DC").format("xml").execute();
        assertEquals(200, response.getStatus());

        DatastreamProfile profile = response.getDatastreamProfile();
        assertEquals(testPid, profile.getPid());
        assertEquals("DC", profile.getDsID());
    }

    @Test
    public void testGetDatastreamAsOfDateTimeAsXML() throws Exception {
        GetDatastreamResponse response = null;

        response =
                getDatastream(testPid, "DC").format("xml").asOfDateTime(
                        "9999-01-01T00:01:04.567Z").execute();
        DatastreamProfile profile = response.getDatastreamProfile();
        assertEquals(testPid, profile.getPid());
        assertEquals("DC", profile.getDsID());
    }

    /**
     * Test retrieving the dsState of a datastream.
     *
     * @throws Exception
     */
    @Test
    public void testGetDatastreamState() throws Exception {
        GetDatastreamResponse response = null;