ResultUtils { public static <S extends AnnotatedSpace<A>, A extends TypedAxis> char getExponent(final S space) { final long dimensions = AxisUtils.countSpatialDimensions(space); if (dimensions == 2) { return '\u00B2'; } if (dimensions == 3) { return '\u00B3'; } if (dimensions == 4) { return '\u2074'; } if (dimensions == 5) { return '\u2075'; } if (dimensions == 6) { return '\u2076'; } if (dimensions == 7) { return '\u2077'; } if (dimensions == 8) { return '\u2078'; } if (dimensions == 9) { return '\u2079'; } return '\u0000'; } 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 testGetExponent() { final char[] expected = { '\u0000', '\u00B2', '\u00B3', '\u2074', '\u2075', '\u2076', '\u2077', '\u2078', '\u2079', '\u0000' }; 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 char exponent = ResultUtils.getExponent(mockImage); assertEquals("Wrong exponent character", expected[i], exponent); } }
@Test(expected = NullPointerException.class) public void testGetExponentThrowsNPEIfSpaceNull() { ResultUtils.getExponent(null); }