use of com.bakdata.conquery.models.common.daterange.CDateRange in project conquery by bakdata.
the class DateContextTest method rangeAbsYearTestWithCoarse.
@Test
public void rangeAbsYearTestWithCoarse() {
CDateRange mask = CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2005, 4, 21));
List<DateContext> contexts = DateContext.generateAbsoluteContexts(mask, ExportForm.getResolutionAlignmentMap(YEARS.getThisAndCoarserSubdivisions(), YEAR));
assertThat(contexts).extracting(DateContext::getDateRange).containsExactly(mask, CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2001, 12, 31)), CDateRange.of(LocalDate.of(2002, 1, 1), LocalDate.of(2002, 12, 31)), CDateRange.of(LocalDate.of(2003, 1, 1), LocalDate.of(2003, 12, 31)), CDateRange.of(LocalDate.of(2004, 1, 1), LocalDate.of(2004, 12, 31)), CDateRange.of(LocalDate.of(2005, 1, 1), LocalDate.of(2005, 4, 21)));
assertThat(contexts).extracting(DateContext::getFeatureGroup).containsOnly(FeatureGroup.OUTCOME);
}
use of com.bakdata.conquery.models.common.daterange.CDateRange in project conquery by bakdata.
the class DateContextTest method rangeAbsYearTestWithoutCoarse.
@Test
public void rangeAbsYearTestWithoutCoarse() {
CDateRange mask = CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2005, 4, 21));
List<DateContext> contexts = DateContext.generateAbsoluteContexts(mask, ExportForm.getResolutionAlignmentMap(List.of(YEARS), YEAR));
assertThat(contexts).extracting(DateContext::getDateRange).containsExactly(CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2001, 12, 31)), CDateRange.of(LocalDate.of(2002, 1, 1), LocalDate.of(2002, 12, 31)), CDateRange.of(LocalDate.of(2003, 1, 1), LocalDate.of(2003, 12, 31)), CDateRange.of(LocalDate.of(2004, 1, 1), LocalDate.of(2004, 12, 31)), CDateRange.of(LocalDate.of(2005, 1, 1), LocalDate.of(2005, 4, 21)));
assertThat(contexts).extracting(DateContext::getFeatureGroup).containsOnly(FeatureGroup.OUTCOME);
}
use of com.bakdata.conquery.models.common.daterange.CDateRange in project conquery by bakdata.
the class DateContextTest method rangeAbsQuarterTestWithCoarse.
@Test
public void rangeAbsQuarterTestWithCoarse() {
CDateRange mask = CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2003, 4, 21));
List<DateContext> contexts = DateContext.generateAbsoluteContexts(mask, ExportForm.getResolutionAlignmentMap(QUARTERS.getThisAndCoarserSubdivisions(), QUARTER));
assertThat(contexts).extracting(DateContext::getDateRange).containsExactly(// Complete
mask, // Years
CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2002, 3, 31)), CDateRange.of(LocalDate.of(2002, 4, 1), LocalDate.of(2003, 3, 31)), CDateRange.of(LocalDate.of(2003, 4, 1), LocalDate.of(2003, 4, 21)), // Quarters
CDateRange.of(LocalDate.of(2001, 5, 23), LocalDate.of(2001, 6, 30)), CDateRange.of(LocalDate.of(2001, 7, 1), LocalDate.of(2001, 9, 30)), CDateRange.of(LocalDate.of(2001, 10, 1), LocalDate.of(2001, 12, 31)), CDateRange.of(LocalDate.of(2002, 1, 1), LocalDate.of(2002, 3, 31)), CDateRange.of(LocalDate.of(2002, 4, 1), LocalDate.of(2002, 6, 30)), CDateRange.of(LocalDate.of(2002, 7, 1), LocalDate.of(2002, 9, 30)), CDateRange.of(LocalDate.of(2002, 10, 1), LocalDate.of(2002, 12, 31)), CDateRange.of(LocalDate.of(2003, 1, 1), LocalDate.of(2003, 3, 31)), CDateRange.of(LocalDate.of(2003, 4, 1), LocalDate.of(2003, 4, 21)));
assertThat(contexts).extracting(DateContext::getFeatureGroup).containsOnly(FeatureGroup.OUTCOME);
}
use of com.bakdata.conquery.models.common.daterange.CDateRange in project conquery by bakdata.
the class RangeTest method coveredQuarters.
@Test
public void coveredQuarters() {
CDateRange dateRange = CDateRange.of(LocalDate.of(2000, 9, 2), LocalDate.of(2002, 3, 15));
List<CDateRange> expected = new ArrayList<>();
expected.add(CDateRange.of(LocalDate.of(2000, 9, 2), LocalDate.of(2000, 9, 30)));
expected.add(CDateRange.of(LocalDate.of(2000, 10, 1), LocalDate.of(2000, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2001, 1, 1), LocalDate.of(2001, 3, 31)));
expected.add(CDateRange.of(LocalDate.of(2001, 4, 1), LocalDate.of(2001, 6, 30)));
expected.add(CDateRange.of(LocalDate.of(2001, 7, 1), LocalDate.of(2001, 9, 30)));
expected.add(CDateRange.of(LocalDate.of(2001, 10, 1), LocalDate.of(2001, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2002, 1, 1), LocalDate.of(2002, 3, 15)));
assertThat(dateRange.getCoveredQuarters()).containsExactlyInAnyOrderElementsOf(expected);
}
use of com.bakdata.conquery.models.common.daterange.CDateRange in project conquery by bakdata.
the class RangeTest method coveredYears.
@Test
public void coveredYears() {
CDateRange dateRange = CDateRange.of(LocalDate.of(2000, 9, 2), LocalDate.of(2005, 3, 15));
List<CDateRange> expected = new ArrayList<>();
expected.add(CDateRange.of(LocalDate.of(2000, 9, 2), LocalDate.of(2000, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2001, 1, 1), LocalDate.of(2001, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2002, 1, 1), LocalDate.of(2002, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2003, 1, 1), LocalDate.of(2003, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2004, 1, 1), LocalDate.of(2004, 12, 31)));
expected.add(CDateRange.of(LocalDate.of(2005, 1, 1), LocalDate.of(2005, 3, 15)));
assertThat(dateRange.getCoveredYears()).containsExactlyInAnyOrderElementsOf(expected);
}
Aggregations