### Question:
MapUnitToPixelTransform { public Point<C2D> toPoint(Pixel pixel) { double x = extent.lowerLeft().getX() + mapUnitsPerPixelX * (pixel.x - this.pixelRange.getMinX()); double y = extent.upperRight().getY() - mapUnitsPerPixelY * (pixel.y - this.pixelRange.getMinY()); return point(extent.getCoordinateReferenceSystem(), c(x, y)); } MapUnitToPixelTransform(Envelope<C2D> extent, PixelRange pixelRange);  MapUnitToPixelTransform(Envelope<C2D> extent, int minPixelX, int minPixelY, double mapUnitsPerPixel);  MapUnitToPixelTransform(Envelope<C2D> extent, double mapUnitsPerPixel); PixelRange getRange(); Envelope<C2D> getDomain(); Point<C2D> toPoint(Pixel pixel); Pixel toPixel(C2D point); Pixel toPixel(C2D point, boolean leftBorderInclusive, boolean lowerBorderInclusive); PixelRange toPixelRange(Envelope<C2D> bbox);  }### Answer:
@Test public void test_pixel_outside_range_is_allowed() { Point<C2D> received = pixRangeBasedTransform.toPoint(Pixel.valueOf(0, 0)); Point<C2D> expected = new Point<>(new C2D(-90, 120), crs); assertEquals(expected, received); }
@Test public void test_pixel_to_point_on_pixrange_based_transform() { Point<C2D> pnt = pixRangeBasedTransform.toPoint(Pixel.valueOf(100, 50)); assertTrue(equalsWithinTolerance(point(crs, c(10, 100)), pnt, Math.ulp(100d))); pnt = pixRangeBasedTransform.toPoint(Pixel.valueOf(100, 249)); assertTrue(equalsWithinTolerance(point(crs, c(10, 20.4)), pnt, Math.ulp(250d))); pnt = pixRangeBasedTransform.toPoint(Pixel.valueOf(199, 249)); assertTrue(equalsWithinTolerance(point(crs,c(109, 20.4)), pnt, Math.ulp(250d))); pnt = pixRangeBasedTransform.toPoint(Pixel.valueOf(199, 50)); assertTrue(equalsWithinTolerance(point(crs, c(109, 100)), pnt, Math.ulp(200d))); pnt = pixRangeBasedTransform.toPoint(Pixel.valueOf(150, 150)); assertTrue(equalsWithinTolerance(point(crs,c(60, 60)), pnt, Math.ulp(150d))); }
@Test public void test_pixel_to_point_on_upp_based_transform() { Point<C2D> pnt = uppBasedTransform.toPoint(Pixel.valueOf(100, 200)); assertTrue(equalsWithinTolerance(point(crs,c(10, 100)), pnt, Math.ulp(100d))); pnt = uppBasedTransform.toPoint(Pixel.valueOf(100, 999)); assertTrue(equalsWithinTolerance(point(crs, c(10, 20.1)), pnt, Math.ulp(20d))); pnt = uppBasedTransform.toPoint(Pixel.valueOf(1099, 999)); assertTrue(equalsWithinTolerance(point(crs, c(109.9, 20.1)), pnt, Math.ulp(100d))); pnt = uppBasedTransform.toPoint(Pixel.valueOf(1099, 200)); assertTrue(equalsWithinTolerance(point(crs, c(109.9, 100)), pnt, Math.ulp(100d))); pnt = uppBasedTransform.toPoint(Pixel.valueOf(600, 600)); assertTrue(equalsWithinTolerance(point(crs, c(60, 60)), pnt, Math.ulp(60d))); }