@@ -0,0 +1,2578 @@
+package ucar.nc2.ft2.coverage;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.Parameterized;%0Aimport ucar.ma2.DataType;%0Aimport ucar.ma2.InvalidRangeException;%0Aimport ucar.ma2.Range;%0Aimport ucar.nc2.constants.AxisType;%0Aimport ucar.nc2.ft2.coverage.CoverageCoordAxis.Spacing;%0A%0A@RunWith(Parameterized.class)%0Apublic class TestCoordAxisHelper %7B%0A%0A  @Parameterized.Parameters(name = %22%7B0%7D, %7B1%7D%22)%0A  public static List%3CObject%5B%5D%3E getTestParameters() %7B%0A    return Arrays.asList(%0A%0A        new Object%5B%5D %7BSpacing.regularPoint, new double%5B%5D %7B0.0, 10.0, 20.0, 30.0, 40.0%7D%7D,%0A        new Object%5B%5D %7BSpacing.irregularPoint, new double%5B%5D %7B0.0, 5.0, 20.0, 30.0, 40.0%7D%7D,%0A        new Object%5B%5D %7BSpacing.regularInterval, new double%5B%5D %7B0.0, 10.0, 20.0, 30.0, 40.0%7D%7D,%0A        new Object%5B%5D %7BSpacing.contiguousInterval, new double%5B%5D %7B0.0, 5.0, 20.0, 30.0, 40.0%7D%7D,%0A        new Object%5B%5D %7BSpacing.discontiguousInterval, new double%5B%5D %7B0.0, 0.0, 20.0, 30.0, 40.0, 40.0, 50.0, 50.0%7D%7D%0A%0A    );%0A  %7D%0A%0A  private final Spacing spacing;%0A  private final double%5B%5D values;%0A%0A  public TestCoordAxisHelper(Spacing spacing, double%5B%5D values) %7B%0A    this.spacing = spacing;%0A    this.values = values;%0A  %7D%0A%0A  @Test%0A  public void shouldSubsetAxisByRange() throws InvalidRangeException %7B%0A    final AxisType axisType = AxisType.Time;%0A    final double resolution = values%5B1%5D - values%5B0%5D;%0A%0A    final CoverageCoordAxisBuilder coverageCoordAxisBuilder = new CoverageCoordAxisBuilder(%22name%22, %22unit%22,%0A        %22description%22, DataType.DOUBLE, axisType, null, CoverageCoordAxis.DependenceType.independent, null, spacing,%0A        values.length, values%5B0%5D, values%5Bvalues.length - 1%5D, resolution, values, null);%0A    final CoverageCoordAxis1D coverageCoordAxis = new CoverageCoordAxis1D(coverageCoordAxisBuilder);%0A    final CoordAxisHelper coordAxisHelper = new CoordAxisHelper(coverageCoordAxis);%0A%0A    final Range subsetRange = new Range(1, 3);%0A    final CoverageCoordAxisBuilder subsetBuilder = coordAxisHelper.subsetByIndex(subsetRange);%0A    assertThat(subsetBuilder).isNotNull();%0A    assertThat(subsetBuilder.axisType).isEqualTo(axisType);%0A    assertThat(subsetBuilder.startValue).isEqualTo(values%5BsubsetRange.first()%5D);%0A    assertThat(subsetBuilder.endValue).isEqualTo(values%5BsubsetRange.last()%5D);%0A%0A    if (spacing == Spacing.regularPoint %7C%7C spacing == Spacing.regularInterval) %7B%0A      assertThat(subsetBuilder.values).isNull();%0A    %7D else %7B%0A      assertThat(subsetBuilder.values).isNotNull();%0A    %7D%0A  %7D%0A%7D%0A

Add test for subsetting a coverage axis