### Question:
DimensionalIndex extends ISize { public int rollup(int xValue, int yValue, int zValue) { check(xValue,super.getX(),'x'); check(yValue,super.getY(),'y'); check(zValue,super.getZ(),'z'); return xValue + yValue * getX( ) + zValue * xy; } DimensionalIndex(int newX, int newY, int newZ);  DimensionalIndex(String newX, String newY, String newZ);  DimensionalIndex(ISize source); int rollup(int xValue, int  yValue, int zValue);  }### Answer:
@Test public void validateIndexes( ) { boolean punched[] = new boolean[index.getXYZ()]; for (int x = 0; x < mX; x++) for (int y = 0; y < mY; y++) for (int z = 0; z < mZ; z++) { final int idx = index.rollup(x,y,z); assertFalse(punched[idx]); punched[idx] = true; } for (int p = 0; p < punched.length; ++p) { assertTrue(punched[p]); } }
@Test(expected = RuntimeException.class) public void badX( ) { index.rollup(mX, 0,0); }
@Test(expected = RuntimeException.class) public void badY( ) { index.rollup(0, mY,0); }
@Test(expected = RuntimeException.class) public void badZ( ) { index.rollup(0,0,mZ); }
@Test public void badZmsg( ) { try { index.rollup(0,0,mZ); Assert.fail("should have thrown an exception"); } catch (RuntimeException re) { } }