use of org.obiba.mica.study.domain.DataCollectionEvent in project mica2 by obiba.
the class TestDataCollectionEventSort method test_partial_date_fields.
@Test
public void test_partial_date_fields() {
Population population = createPopulation("Test Population", createEvent("A", 2010, null, 2020, null), createEvent("A", 1997, 1, 2000, null));
DataCollectionEvent event = Iterables.get(population.getDataCollectionEvents(), 0);
assertThat(event.getStart()).isEqualTo(of(1997, 1));
}
use of org.obiba.mica.study.domain.DataCollectionEvent in project mica2 by obiba.
the class TestDataCollectionEventSort method test_study_population_sort_with_duplicate_event_dates.
@Test
public void test_study_population_sort_with_duplicate_event_dates() {
Study study = new Study();
study.setId("01234567889");
study.addPopulation(createPopulation("Population001", createEvent("A", 2010, 1, 2020, 12), createEvent("B", 2014, 1, 2035, 12), createEvent("C", 2010, 1, 2020, 12)));
Population population = Iterables.get(study.getPopulations(), 0);
SortedSet<DataCollectionEvent> events = population.getDataCollectionEvents();
assertThat(events.size()).isEqualTo(3);
assertThat(Iterables.get(events, 0).getStart()).isEqualTo(of(2010, 1));
assertThat(Iterables.get(events, 1).getStart()).isEqualTo(of(2010, 1));
}
use of org.obiba.mica.study.domain.DataCollectionEvent in project mica2 by obiba.
the class TestDataCollectionEventSort method test_study_population_sort.
@Test
public void test_study_population_sort() {
Study study = new Study();
study.setId("01234567889");
study.addPopulation(createPopulation("Population001", createEvent("A", 2010, 1, 2020, 12), createEvent("A", 2014, 1, 2035, 12)));
study.addPopulation(createPopulation("Population001", createEvent("A", 1997, 8, 1998, 12), createEvent("A", 1996, 1, 2000, 12)));
Population population = Iterables.get(study.getPopulations(), 0);
DataCollectionEvent event = Iterables.get(population.getDataCollectionEvents(), 0);
assertThat(event.getStart()).isEqualTo(of(1996, 1));
}
use of org.obiba.mica.study.domain.DataCollectionEvent in project mica2 by obiba.
the class TestDataCollectionEventSort method test_study_population_sort_with_duplicate_events.
@Test
public void test_study_population_sort_with_duplicate_events() {
Study study = new Study();
study.setId("01234567889");
study.addPopulation(createPopulation("Population001", createEvent("A", "A", 2010, 1, 2020, 12), createEvent("A", "A", 2014, 1, 2035, 12), createEvent("A", "A", 2010, 1, 2020, 12)));
Population population = Iterables.get(study.getPopulations(), 0);
SortedSet<DataCollectionEvent> events = population.getDataCollectionEvents();
assertThat(events.size()).isEqualTo(2);
assertThat(Iterables.get(events, 0).getStart()).isEqualTo(of(2010, 1));
assertThat(Iterables.get(events, 1).getStart()).isEqualTo(of(2014, 1));
}
use of org.obiba.mica.study.domain.DataCollectionEvent in project mica2 by obiba.
the class TestDataCollectionEventSort method createPopulation.
private Population createPopulation(String name, DataCollectionEvent... events) {
Population population = new Population();
population.setName(en(name));
for (DataCollectionEvent event : events) {
population.addDataCollectionEvent(event);
}
return population;
}
Aggregations