LevelImageSupport { public final int getSourceX(int tx) { return getSourceCoord(tx, 0, getSourceWidth() - 1); } LevelImageSupport(int sourceWidth, int sourceHeight, ResolutionLevel level); int getSourceWidth(); int getSourceHeight(); int getLevel(); double getScale(); final int getSourceX(int tx); final int getSourceY(int ty); final int getSourceWidth(int destWidth); final int getSourceHeight(int destHeight); final int getSourceCoord(double destCoord, int min, int max);  }
@Test public void testGetSourceX() { final int w = levelImageSupport.getSourceWidth(); assertEquals(760, w); assertEquals(0, levelImageSupport.getSourceX(0)); assertEquals(1, levelImageSupport.getSourceX(1)); assertEquals(w - 1, levelImageSupport.getSourceX(w - 1)); assertEquals(w - 1, levelImageSupport.getSourceX(w)); assertEquals(w - 1, levelImageSupport.getSourceX(w + 1)); }