ProcessingRectangleCalculator { static Rectangle intersectionSafe(Rectangle r1, Rectangle r2) { if (r1 == null) { return r2; } else if (r2 == null) { return r1; } else { return r1.intersection(r2); } } ProcessingRectangleCalculator(Geometry regionGeometry, Rectangle roiRectangle, InputSplit inputSplit, boolean fullSwath); Rectangle computeRect(); static Rectangle getGeometryAsRectangle(Product product, Geometry regionGeometry);  }
@Test public void testIntersectionSafe() throws Exception { Rectangle r1 = new Rectangle(30, 30); Rectangle r2 = new Rectangle(10, 10, 30, 30); Rectangle r3 = new Rectangle(10, 10, 20, 20); assertNull(intersectionSafe(null, null)); assertSame(r1, intersectionSafe(r1, null)); assertSame(r2, intersectionSafe(null, r2)); assertEquals(r3, intersectionSafe(r1, r2)); }