@Test
public void verifyRemoveOffsetPeriodsIfNotNeeded()
{

    // Given
    Period month1 = createMonthlyPeriod( 2020, 1 ); // this period will be preserved
    Period month2 = createMonthlyPeriod( 2020, 2 ); // this period will be preserved
    Period month3 = createMonthlyPeriod( 2020, 3 );
    month3.setShifted( true );
    Period month4 = createMonthlyPeriod( 2020, 4 );
    month4.setShifted( true );
    DataQueryParams queryParams = DataQueryParams.newBuilder()
        .withPeriods( Lists.newArrayList( month1, month2, month3, month4 ) )
        .withDataElements( Lists.newArrayList( createDataElement( 0 ), createDataElement( 0 ) ) )
        .build();
    // When
    final DataQueryParams dataQueryParams = PeriodOffsetUtils
        .removeOffsetPeriodsIfNotNeeded( queryParams );
    // Then
    assertThat( dataQueryParams.getPeriods(), hasSize( 2 ) );
    assertIsoPeriods( dataQueryParams.getPeriods(), "202001", "202002" );
}