### Question:
GridDef { public final double getDiagonal(int x, int y) { final double lon1 = getLon(x); final double lat1 = getLat(y); final double lon2 = lon1 + resolutionX; final double lat2 = lat1 - resolutionY; return MathUtils.sphereDistanceDeg(6371.0, lon1, lat1, lon2, lat2); } private  GridDef(int width, int height, double easting, double northing, double resolutionX, double resolutionY); static GridDef createGlobal(double resolution); static GridDef createGlobal(int width, int height); static GridDef createRaster(int width, int height); int getTime(); int getWidth(); int getHeight(); double getEasting(); double getNorthing(); double getResolutionX(); double getResolutionY(); double getResolution(); int wrapX(int x); double getCenterLon(int x); double getCenterLat(int y); final double getDiagonal(int x, int y); final int getGridX(double lon, boolean crop); final int getGridY(double lat, boolean crop); Rectangle2D getLonLatRectangle(int x, int y); Rectangle getGridRectangle(Rectangle2D lonLatRectangle); Rectangle getGridRectangle(double minLon, double minLat, double maxLon, double maxLat); Rectangle getGridRectangle(int x, int y, GridDef gridDef); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testGetDiagonal() { assertEquals(10007.543398010286, gridDef90.getDiagonal(0, 0), 1e-8); assertEquals(10007.543398010286, gridDef90.getDiagonal(2, 0), 1e-8); assertEquals(10007.543398010286, gridDef90.getDiagonal(0, 2), 1e-8); assertEquals(555.9746332227928, gridDef5.getDiagonal(0, 0), 1e-8); assertEquals(555.9746332227928, gridDef5.getDiagonal(10, 0), 1e-8); assertEquals(742.9651956574585, gridDef5.getDiagonal(0, 12), 1e-8); }