### Question:
PixelRange { public static PixelRange union(PixelRange b1, PixelRange b2) { if (b1 == null) return b2; if (b2 == null) return b1; int minX = Math.min(b1.getMinX(), b2.getMinX()); int minY = Math.min(b1.getMinY(), b2.getMinY()); int maxX = Math.max(b1.getMaxX(), b2.getMaxX()); int maxY = Math.max(b1.getMaxY(), b2.getMaxY()); Dimension dim = new Dimension(maxX - minX + 1, maxY - minY + 1); return new PixelRange(minX, minY, dim); } PixelRange(int minX, int minY, int width, int height);  PixelRange(Pixel origin, Dimension dimension);  PixelRange(int minX, int minY, Dimension dimension); static PixelRange fromArray(double[] arr); static PixelRange union(PixelRange b1, PixelRange b2); int getMinX(); int getMinY(); int getWidth(); int getHeight(); int getMaxX(); int getMaxY(); boolean within(PixelRange bounds); boolean contains(Pixel pixel); String toString(); Dimension getDimension(); double[] toArray(double[] dst); @Override boolean equals(Object o); @Override int hashCode(); Rectangle toRect();  }### Answer:
@Test public void test_union_image_bounds() { PixelRange b1 = new PixelRange(768, 0, new Dimension(256, 256)); PixelRange b2 = new PixelRange(512, 256, new Dimension(256, 512)); PixelRange expected = new PixelRange(512, 0, new Dimension(512, 768)); PixelRange received = PixelRange.union(b1, b2); assertEquals(expected, received); }
@Test public void test_union_with_null() { PixelRange expected = new PixelRange(768, 0, new Dimension(256, 256)); PixelRange received = PixelRange.union(expected, null); assertEquals(expected, received); received = PixelRange.union(null, expected); assertEquals(expected, received); }