final CoverageDimensionImpl coverageDim = new CoverageDimensionImpl();
final String wrappedName = "wrapped";
coverageDim.setName(wrappedName);
coverageDim.setDimensionType(SampleDimensionType.REAL_64BITS);
// Creation of the WrappedSampleDimension
SampleDimension wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);
// Get the range
NumberRange<? extends Number> wrappedRange = ((WrappedSampleDimension) wrappedDim)
.getRange();
// Ensure the range is not present
assertNull(wrappedRange);
// Check if min and max are taken from the categories
assertEquals(-9999, wrappedDim.getMinimumValue(), DELTA);
assertEquals(1000, wrappedDim.getMaximumValue(), DELTA);
// Check that the description is equal to the sample dimension name
assertEquals(wrappedName, wrappedDim.getDescription().toString());
// Configure a new GridSampleDimension without categories
sampleDim = new GridSampleDimension("original", null, new BaseUnit<Quantity>("test"));
// New wrapped sample dimension
wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);
// Get the range
wrappedRange = ((WrappedSampleDimension) wrappedDim).getRange();
// Ensure the range is not present
assertNull(wrappedRange);
// Check if min and max are taken from the categories
assertEquals(Double.NEGATIVE_INFINITY, wrappedDim.getMinimumValue(), DELTA);
assertEquals(Double.POSITIVE_INFINITY, wrappedDim.getMaximumValue(), DELTA);
}