Search in sources :

Example 1 with SimpleCollection

use of org.hisp.dhis.dxf2.metadata.merge.SimpleCollection in project dhis2-core by dhis2.

the class MergeServiceTest method simpleCollection.

@Test
public void simpleCollection() {
    Date date = new Date();
    SimpleCollection source = new SimpleCollection("name");
    source.getSimples().add(new Simple("simple", 10, date, false, 123, 2.5f));
    source.getSimples().add(new Simple("simple", 20, date, false, 123, 2.5f));
    source.getSimples().add(new Simple("simple", 30, date, false, 123, 2.5f));
    SimpleCollection target = new SimpleCollection("target");
    mergeService.merge(new MergeParams<>(source, target).setMergeMode(MergeMode.MERGE));
    assertEquals("name", target.getName());
    assertEquals(3, target.getSimples().size());
    assertTrue(target.getSimples().contains(source.getSimples().get(0)));
    assertTrue(target.getSimples().contains(source.getSimples().get(1)));
    assertTrue(target.getSimples().contains(source.getSimples().get(2)));
}
Also used : MergeParams(org.hisp.dhis.schema.MergeParams) Date(java.util.Date) SimpleCollection(org.hisp.dhis.dxf2.metadata.merge.SimpleCollection) Simple(org.hisp.dhis.dxf2.metadata.merge.Simple) Test(org.junit.Test) DhisSpringTest(org.hisp.dhis.DhisSpringTest)

Aggregations

Date (java.util.Date)1 DhisSpringTest (org.hisp.dhis.DhisSpringTest)1 Simple (org.hisp.dhis.dxf2.metadata.merge.Simple)1 SimpleCollection (org.hisp.dhis.dxf2.metadata.merge.SimpleCollection)1 MergeParams (org.hisp.dhis.schema.MergeParams)1 Test (org.junit.Test)1