Search in sources :

Example 6 with Record2

use of org.motechproject.mds.testutil.records.Record2 in project motech by motech.

the class CsvImporterExporterTest method testInstances.

private List<Record2> testInstances(IdMode idMode) {
    List<Record2> instances = new ArrayList<>();
    for (int i = 0; i < INSTANCE_COUNT; i++) {
        Record2 record = new Record2();
        if (idMode == IdMode.INCLUDE_ID) {
            record.setId((long) i);
        }
        record.setCreator("the creator " + i);
        record.setOwner("the owner " + i);
        record.setModifiedBy("username" + i);
        record.setCreationDate(NOW.plusMinutes(i));
        record.setModificationDate(NOW.plusHours(i));
        record.setValue("value " + i);
        record.setDate(NOW.plusSeconds(i).toDate());
        record.setDateIgnoredByRest(NOW.minusHours(i).toDate());
        record.setEnumField(enumValue(i));
        record.setEnumListField(Arrays.asList(enumValue(i + 1), enumValue(i + 2)));
        record.setSingleRelationship(new RelatedClass(relatedId(i)));
        record.setMultiRelationship(new ArrayList<>((Arrays.asList(new RelatedClass(relatedId(i + 1)), new RelatedClass(relatedId(i + 2))))));
        instances.add(record);
    }
    return instances;
}
Also used : ArrayList(java.util.ArrayList) RelatedClass(org.motechproject.mds.testutil.records.RelatedClass) Record2(org.motechproject.mds.testutil.records.Record2)

Aggregations

Record2 (org.motechproject.mds.testutil.records.Record2)6 StringReader (java.io.StringReader)3 Test (org.junit.Test)3 CsvImportResults (org.motechproject.mds.dto.CsvImportResults)3 ArrayList (java.util.ArrayList)2 StringWriter (java.io.StringWriter)1 Map (java.util.Map)1 Matchers.anyMap (org.mockito.Matchers.anyMap)1 Matchers.anyString (org.mockito.Matchers.anyString)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 QueryParams (org.motechproject.mds.query.QueryParams)1 RelatedClass (org.motechproject.mds.testutil.records.RelatedClass)1