
package integration.report;

import org.apache.http.HttpResponse;
import org.junit.Test;
import org.openarchives.oai._2.OAIPMHtype;
import org.openarchives.oai._2.VerbType;

import javax.xml.bind.JAXBElement;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class ListMetadataPrefixesIT extends ReportIT {
    @Test
    public void testListMetadataPrefixes() throws Exception {
        HttpResponse resp = getOAIPMHResponse(VerbType.LIST_METADATA_FORMATS.value(), null, null, null, null, null);
        assertEquals(200, resp.getStatusLine().getStatusCode());
        OAIPMHtype oaipmh =
                ((JAXBElement<OAIPMHtype>) this.unmarshaller.unmarshal(resp.getEntity().getContent())).getValue();
        assertEquals(0, oaipmh.getError().size());
        assertNotNull(oaipmh.getRequest());
        assertEquals(VerbType.LIST_METADATA_FORMATS.value(), oaipmh.getRequest().getVerb().value());
        assertEquals(3, oaipmh.getListMetadataFormats().getMetadataFormat().size());
    }
}
