### Question:
UnionMasksTilesComputing extends AbstractImageTilesParallelComputing { public ProductData runTilesInParallel(int threadCount, Executor threadPool) throws Exception { super.executeInParallel(threadCount, threadPool); return this.productData; } UnionMasksTilesComputing(IntMatrix colorFillerMatrix, IntSet currentSegmentationTrimmingRegionKeys,
                                    IntSet previousSegmentationTrimmingRegionKeys, int tileWidth, int tileHeight); ProductData runTilesInParallel(int threadCount, Executor threadPool);  }### Answer:
@Test public void testTrimmingRegionTilesComputing() throws Exception { Dimension tileSize = JAI.getDefaultTileSize(); int threadCount = Runtime.getRuntime().availableProcessors() - 1; ExecutorService threadPool = Executors.newCachedThreadPool(); ProductReaderPlugIn productReaderPlugIn = buildDimapProductReaderPlugIn(); Path unionFolder = this.forestCoverChangeTestsFolderPath.resolve("union-mask"); File currentSegmentationSourceProductFile = unionFolder.resolve("S2A_R093_T35UMP_20170628T092026_grm_fill.dim").toFile(); Product currentSegmentationSourceProduct = productReaderPlugIn.createReaderInstance().readProductNodes(currentSegmentationSourceProductFile, null); IntSet currentSegmentationTrimmingRegionKeys = buildCurrentSegmentationTrimmingRegionKeys(); IntSet previousSegmentationTrimmingRegionKeys = buildPreviousSegmentationTrimmingRegionKeys(); ProductBandToMatrixConverter converter1 = new ProductBandToMatrixConverter(currentSegmentationSourceProduct, tileSize.width, tileSize.height); IntMatrix currentSegmentationSourceMatrix = converter1.runTilesInParallel(threadCount, threadPool); UnionMasksTilesComputing tilesComputing = new UnionMasksTilesComputing(currentSegmentationSourceMatrix, currentSegmentationTrimmingRegionKeys, previousSegmentationTrimmingRegionKeys, tileSize.width, tileSize.height); ProductData productData = tilesComputing.runTilesInParallel(threadCount, threadPool); assertNotNull(productData); Band targetBand = new Band("band_1", ProductData.TYPE_INT32, currentSegmentationSourceProduct.getSceneRasterWidth(), currentSegmentationSourceProduct.getSceneRasterHeight()); targetBand.setData(productData); targetBand.setSourceImage(null); targetBand.getSourceImage(); assertEquals(2, targetBand.getSampleInt(147, 163)); assertEquals(2, targetBand.getSampleInt(57, 237)); assertEquals(0, targetBand.getSampleInt(33, 434)); assertEquals(0, targetBand.getSampleInt(478, 51)); assertEquals(2, targetBand.getSampleInt(509, 212)); assertEquals(2, targetBand.getSampleInt(209, 533)); assertEquals(2, targetBand.getSampleInt(10, 508)); assertEquals(2, targetBand.getSampleInt(254, 476)); assertEquals(2, targetBand.getSampleInt(84, 343)); assertEquals(0, targetBand.getSampleInt(14, 468)); assertEquals(0, targetBand.getSampleInt(205, 139)); assertEquals(0, targetBand.getSampleInt(22, 325)); assertEquals(0, targetBand.getSampleInt(196, 397)); assertEquals(2, targetBand.getSampleInt(3, 433)); assertEquals(2, targetBand.getSampleInt(506, 214)); }