Search in sources :

Example 1 with DummyReference

use of org.javarosa.core.model.test.DummyReference in project javarosa by opendatakit.

the class SubmissionParserTest method parseSubmission.

@Test
public void parseSubmission() throws Exception {
    // Given
    final SubmissionParser submissionParser = new SubmissionParser();
    final Element element = new Element();
    element.setAttribute(null, "mediatype", "application/xml");
    element.setAttribute(null, "custom_attribute", "custom value");
    final String method = "POST";
    final String action = "ACTION";
    final IDataReference ref = new DummyReference();
    // When
    final SubmissionProfile submissionProfile = submissionParser.parseSubmission(method, action, ref, element);
    // Then
    assertEquals(action, submissionProfile.getAction());
    assertEquals(method, submissionProfile.getMethod());
    assertEquals(ref, submissionProfile.getRef());
    assertEquals("application/xml", submissionProfile.getMediaType());
    assertEquals("custom value", submissionProfile.getAttribute("custom_attribute"));
}
Also used : DummyReference(org.javarosa.core.model.test.DummyReference) IDataReference(org.javarosa.core.model.IDataReference) Element(org.kxml2.kdom.Element) SubmissionProfile(org.javarosa.core.model.SubmissionProfile) Test(org.junit.Test)

Aggregations

IDataReference (org.javarosa.core.model.IDataReference)1 SubmissionProfile (org.javarosa.core.model.SubmissionProfile)1 DummyReference (org.javarosa.core.model.test.DummyReference)1 Test (org.junit.Test)1 Element (org.kxml2.kdom.Element)1