ImagePlusUtil { public static boolean is3D(final ImagePlus image) { return image.getNSlices() > 1; } private  ImagePlusUtil(); static double anisotropy(final ImagePlus image); static ImagePlus cleanDuplicate(final ImagePlus image); static boolean is3D(final ImagePlus image); static boolean isBinaryColour(final ImagePlus image);  }
@Test public void testIs3D() throws AssertionError { final ImagePlus imagePlus = mock(ImagePlus.class); when(imagePlus.getNSlices()).thenReturn(10); final boolean result = ImagePlusUtil.is3D(imagePlus); assertTrue("Image with more than 1 slice should be 3D", result); }
@Test(expected = NullPointerException.class) public void testIs3DThrowsNPEIfImageNull() { ImagePlusUtil.is3D(null); }
@Test public void testIs3DFalseIfImage2D() { final ImagePlus imagePlus = mock(ImagePlus.class); when(imagePlus.getNSlices()).thenReturn(1); final boolean result = ImagePlusUtil.is3D(imagePlus); assertFalse("2D image should not be 3D", result); }