@Test
public void verifyHeaderCreationBasedOnQueryItemsAndDimensions()
{

    // Given
    DimensionalObject periods = new BaseDimensionalObject( DimensionalObject.PERIOD_DIM_ID, DimensionType.PERIOD,
        Lists.newArrayList( peA ) );
    DimensionalObject orgUnits = new BaseDimensionalObject( DimensionalObject.ORGUNIT_DIM_ID,
        DimensionType.ORGANISATION_UNIT, "ouA", Lists.newArrayList( ouA ) );
    QueryItem qiA = new QueryItem( deA, null, deA.getValueType(), deA.getAggregationType(), null );
    QueryItem qiB = new QueryItem( deB, null, deB.getValueType(), deB.getAggregationType(), null );
    QueryItem qiC = new QueryItem( deC, null, deC.getValueType(), deC.getAggregationType(), null );
    EventQueryParams params = new EventQueryParams.Builder()
        .addDimension( periods )
        .addDimension( orgUnits )
        .addItem( qiA ).addItem( qiB ).addItem( qiC )
        .withCoordinateField( deB.getUid() )
        .withSkipData( true )
        .withSkipMeta( false )
        .withApiVersion( DhisApiVersion.V33 )
        .build();
    when( securityManager.withUserConstraints( any( EventQueryParams.class ) ) ).thenReturn( params );
    // When
    Grid grid = dummyAnalyticsService.getGrid( params );
    // Then
    final List<GridHeader> headers = grid.getHeaders();
    assertThat( headers, is( notNullValue() ) );
    assertThat( headers, hasSize( 4 ) );
    assertHeader( headers.get( 0 ), "ou", "ouA", ValueType.TEXT, String.class.getName() );
    assertHeader( headers.get( 1 ), deA.getUid(), deA.getName(), ValueType.TEXT, String.class.getName() );
    assertHeader( headers.get( 2 ), deB.getUid(), deB.getName(), ValueType.COORDINATE, Point.class.getName() );
    assertHeader( headers.get( 3 ), deC.getUid(), deC.getName(), ValueType.NUMBER, Double.class.getName() );
}