ResultUtils { public static <S extends AnnotatedSpace<A>, A extends TypedAxis> String getSizeDescription(final S space) { final long dimensions = AxisUtils.countSpatialDimensions(space); if (dimensions == 2) { return "Area"; } if (dimensions == 3) { return "Volume"; } return "Size"; } private  ResultUtils(); static char getExponent(final S space); static String getSizeDescription(final S space); static String getUnitHeader(
		final S space, final UnitService unitService, final char exponent); static String getUnitHeader(final ImagePlus imagePlus); static long toConventionalIndex(final AxisType type,
		final long index);  }
@Test public void testGetSizeDescription() { final String[] expected = { "Size", "Area", "Volume", "Size" }; final AxisType spatialAxis = Axes.get("Spatial", true); final CalibratedAxis axis = new DefaultLinearAxis(spatialAxis); final ImgPlus<?> mockImage = mock(ImgPlus.class); when(mockImage.axis(anyInt())).thenReturn(axis); for (int i = 0; i < expected.length; i++) { final int dimensions = i + 1; when(mockImage.numDimensions()).thenReturn(dimensions); final String description = ResultUtils.getSizeDescription(mockImage); assertEquals("Size description is incorrect", expected[i], description); } }
@Test(expected = NullPointerException.class) public void testGetSizeDescriptionThrowsNPEIfSpaceNull() { ResultUtils.getSizeDescription(null); }