Search in sources :

Example 6 with Record

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

the class InMemoryQueryFilterTest method record.

private Record record(String value, Long id) {
    Record record = new Record();
    record.setValue(value);
    record.setId(id);
    return record;
}
Also used : Record(org.motechproject.mds.testutil.records.Record)

Example 7 with Record

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

the class InMemoryQueryFilterTest method shouldOrderByFieldDesc.

@Test
public void shouldOrderByFieldDesc() {
    QueryParams queryParams = new QueryParams(new Order("value", Order.Direction.DESC));
    List<Record> result = InMemoryQueryFilter.filter(testCollection, queryParams);
    assertListByValues(result, asList("zet", "test", "something", "nullRecord", "hmm", "hmm", "aaa"));
    assertListByIds(result, asList(1L, 2L, 3L, null, 5L, 6L, 4L));
}
Also used : Order(org.motechproject.mds.util.Order) Record(org.motechproject.mds.testutil.records.Record) Test(org.junit.Test)

Example 8 with Record

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

the class AbstractObjectValueGeneratorTest method shouldReturnCorrectValueWhenPropertyIsNotSet.

@Test
public void shouldReturnCorrectValueWhenPropertyIsNotSet() {
    Object actual = getGenerator().generate(null, new Record(), null);
    assertNotNull(actual);
    assertEquals(getExpectedValue(true), actual);
}
Also used : Record(org.motechproject.mds.testutil.records.Record) Test(org.junit.Test)

Example 9 with Record

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

the class MdsDataProviderTest method testSingleResultLookup.

@Test
public void testSingleResultLookup() {
    Map<String, String> lookupMap = new HashMap<>();
    lookupMap.put("field", PARAM_VALUE);
    Object result = dataProvider.lookup(Record.class.getName(), "singleLookup", lookupMap);
    assertNotNull(result);
    assertTrue("Wrong type returned", result instanceof Record);
    Record record = (Record) result;
    assertEquals("single", record.getValue());
}
Also used : HashMap(java.util.HashMap) Record(org.motechproject.mds.testutil.records.Record) Test(org.junit.Test)

Example 10 with Record

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

the class MdsRestFacadeTest method testRecord.

private Record testRecord() {
    Record record = new Record();
    record.setValue("restTest");
    // dates will be ignored
    record.setDateIgnoredByRest(new Date());
    return record;
}
Also used : Record(org.motechproject.mds.testutil.records.Record) Date(java.util.Date)

Aggregations

Record (org.motechproject.mds.testutil.records.Record)20 Test (org.junit.Test)16 HashMap (java.util.HashMap)4 Order (org.motechproject.mds.util.Order)4 Date (java.util.Date)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 Matchers.anyString (org.mockito.Matchers.anyString)2 Entity (org.motechproject.mds.domain.Entity)2 Field (org.motechproject.mds.domain.Field)2 Type (org.motechproject.mds.domain.Type)2 Record__Trash (org.motechproject.mds.testutil.records.history.Record__Trash)2 Set (java.util.Set)1 Before (org.junit.Before)1 Matchers.anyLong (org.mockito.Matchers.anyLong)1 FieldDto (org.motechproject.mds.dto.FieldDto)1 LookupDto (org.motechproject.mds.dto.LookupDto)1 TypeDto (org.motechproject.mds.dto.TypeDto)1 QueryParams (org.motechproject.mds.query.QueryParams)1