DimensionDescriptor { public static String getDimensionIdentifierFor( final String dimension, final List<DimensionDescriptor> dimensionDescriptors ) { if ( isNotEmpty( dimensionDescriptors ) ) { for ( final DimensionDescriptor dimensionDescriptor : dimensionDescriptors ) { if ( dimensionDescriptor.hasDimension( dimension ) ) { return dimensionDescriptor.getDimensionIdentifier(); } } } return dimension; }  boolean hasDimension( final String dimension ); static String getDimensionIdentifierFor( final String dimension,
        final List<DimensionDescriptor> dimensionDescriptors );  }
@Test public void testRetrieveDescriptiveValue() { final String anyDimensionDynamicValue = "ZyxerTyuP"; final List<DimensionDescriptor> someDimensionDescriptors = mockDimensionDescriptors( anyDimensionDynamicValue ); final String theDimensionToRetrieve = "dx"; final String actualResult = getDimensionIdentifierFor( theDimensionToRetrieve, someDimensionDescriptors ); assertThat( actualResult, is( DATA_X_DIM_ID ) ); }
@Test public void testRetrieveDescriptiveValueDynamicValue() { final String theDynamicDimensionToRetrieve = "ZyxerTyuP"; final List<DimensionDescriptor> someDimensionDescriptors = mockDimensionDescriptors( theDynamicDimensionToRetrieve ); final String actualResult = getDimensionIdentifierFor( theDynamicDimensionToRetrieve, someDimensionDescriptors ); assertThat( actualResult, is( ORGUNIT_DIM_ID ) ); }